🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: finding the application path

#9788
From: John P. McGrath
Date: Fri, 28 Jan 2000 00:00
21 lines
1156 bytes
On Thu, 27 Jan 2000 17:08:47 +0500, Khurram Shakir wrote:

> use
> File f = new File(".");
> String path = f.getPath();

This returns the user directory, not the "application directory".   
This may be the same in some environments, depending on how you invoke 
your application, but nothing in Java says it will be the same.

A simpler equivalent would be:

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

Of course, all of this assumes that your application is stored in a file, 
which is also not necessarily true as far as Java is concerned.

-- 
John P. McGrath
<JPMcGrath@fast.net>
<jpm@nscs.fast.net>
Technical Details
Message-ID: <MPG.12fb233bb390657f98974d@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <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: John P. McGrath <JPMcGrath@fast.net>
Subject: Re: finding the application path
Date: 2000/01/28
Message-ID: <MPG.12fb233bb390657f98974d@forums.borland.com>
X-Deja-AN: 578678549
References: <388105F5.EB860769@istar.ca> <388D9C91.AFBCC27@earthlink.net> <86pbvj$quf20@bornews.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing