🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #7629

Re: Applicatio.Path

#7629
From: John McGrath TeamB
Date: Wed, 10 Jan 2001 08:19
31 lines
2058 bytes
On Tue, 9 Jan 2001 13:17:41 +0500, Khurram Shakir wrote:

> Assuming that you are running an application , you can also
> find the current Path using java.io.File
> File f = new File(".");
> //and then call
> String path = f.getAbsolutePath();
> this will give you the path, from which your application is running,

I believe that he is asking for a method to get the path to the 
application code files (as ill-defined as that idea is in Java).  The 
code above will not do that unless the program is started in the 
directory that contains the application code files.

Under some operating systems and under some circumstances, a Java 
program may be started in the directory containing the code, but that 
is not in any way guaranteed.

Essentially what this program does is give you the value of the System 
property "user.dir".  A simpler way to get that is to use:

    String path = System.getProperty( "user.dir" );

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.14c5e0f49d0f40f6989e6a@forums.borland.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.cs.utwente.nl!newshunter!cosy.sbg.ac.at!news.tele.dk!194.42.224.136!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!not-for-mail
References: <MPG.14c44f7311a2d269989685@forums.inprise.com> <3a5ac923_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,2288b62ea4c95126
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2001-01-10 00:38:30 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.cs.utwente.nl!newshunter!cosy.sbg.ac.at!news.tele.dk!194.42.224.136!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!not-for-mail
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: Applicatio.Path
Date: Wed, 10 Jan 2001 03:19:52 -0500
Organization: Another Netscape Collabra Server User
Lines: 31
Message-ID: <MPG.14c5e0f49d0f40f6989e6a@forums.borland.com>
References: <MPG.14c44f7311a2d269989685@forums.inprise.com> <3a5ac923_2@dnews>
NNTP-Posting-Host: dslcv1-60.fast.net
X-Newsreader: MicroPlanet Gravity v2.30