Article View: borland.public.jbuilder.java.swing
Article #9784Re: finding the application path
From: rwilkman
Date: Thu, 27 Jan 2000 00:00
Date: Thu, 27 Jan 2000 00:00
64 lines
2760 bytes
2760 bytes
Only if . is on the same drive as your class. Windows plays "follow the
current working directory" games as you move between windows apps.
-Rich
Khurram Shakir wrote:
>
> use
> File f = new File(".");
> String path = f.getPath();
> may this will help
>
> regards,
>
> Khurram
>
> Tad Frysinger <tfrysinger@earthlink.net> wrote in message
> news:388D9C91.AFBCC27@earthlink.net...
> > The closest thing is a System property user.dir, but this doesn't
> > necessarily equate to App.path. For your applications, why not set a
> > property (use -D on the command line) in your startup called App.path?
> >
> > Tad Frysinger (TeamB)
> >
> > Alan Shiers wrote:
> >
> > > Hi:
> > > I'm familiar with the File objects .path() and .getAbsolutePath()
> > > methods, but these methods don't allow me to obtain the applications
> > > path on the clients machine. In Visual Basic we have a method called
> > > App.path. When I use this method call as part of a string concatination
> > > App.path returns the path leading up to where the program sits on the
> > > clients computer.
> > > So, if myProgram is in C:\MSS\myProgram, App.path will return
> > > "C:\MSS\".
> > > This is how I would like to use App.path in java:
> > > String st = App.path() + "text.txt";
> > >
> > > Result: st would equal "C:\MSS\text.txt"
> > >
> > > I need a method like this for Java! App.path is a very convenient
> > > method, one that I use a great deal. I need to know, no matter where
> > > the client installs my java program, it will be able to find it's own
> > > application path within the directory structure it is in! Does anyone
> > > have just such a method I can use, or is there already one in existance
> > > in the API that I'm not aware of?
> > >
> > > Regards,
> > >
> > > Alan Shiers
> >
--
=====
Rich Wilkman
Senior Quality Assurance Engineer
JBuilder Team
If something in this post looks like an opinion, walks like an
opinion and quacks like an opinion, it's mine and not that of
my employer.
If you are reading this from a newsgroup post, don't send mail.
=====
Technical Details
Message-ID:
<3890792A.47467CE4@inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<388105F5.EB860769@istar.ca> <388D9C91.AFBCC27@earthlink.net> <86pbvj$quf20@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c2ac60c7065ef2cf X-Google-Attributes: gid111d45,public From: rwilkman <rwilkman@inprise.com> Subject: Re: finding the application path Date: 2000/01/27 Message-ID: <3890792A.47467CE4@inprise.com> X-Deja-AN: 578376368 Content-Transfer-Encoding: 7bit References: <388105F5.EB860769@istar.ca> <388D9C91.AFBCC27@earthlink.net> <86pbvj$quf20@bornews.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing