Article View: borland.public.jbuilder.java.api
Article #291Re: How to get path to current directory?
From: Scott
Date: Sat, 03 Apr 2004 16:04
Date: Sat, 03 Apr 2004 16:04
45 lines
1768 bytes
1768 bytes
Tomek,
I'm new to Java, so I don't know how good this advice is, but try:
String mypath = System.getProperty("user.dir");
That gave me the name of the directory in which my test app was running.
Coverage is here:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties()
and
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperty(java.lang.String)
Hope that helps.
Scott
"Tomek" <pantomaszw@poczta.onet.pl> wrote in message
news:blh1f6$839$1@mail.sources.pl...
> Hello.
>
> How to get path to current directory and put this path to object of class
> String?
> I found FileSystemView.getHomeDirectory() but it returns path to home
> directory for example:
>
> C:\Documments and Settings\Thomas
>
> Thanks for help.
>
>
>
Technical Details
Message-ID:
<406ee0c2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<blh1f6$839$1@mail.sources.pl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,66fe2e00e1cfc947,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2004-04-03 08:10:19 PST Reply-To: "Scott" <scotthpowell@yahoo.com> From: "Scott" <scotthpowell@yahoo.com> Newsgroups: borland.public.jbuilder.java.api References: <blh1f6$839$1@mail.sources.pl> Subject: Re: How to get path to current directory? Date: Sat, 3 Apr 2004 11:04:05 -0500 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.239.150.17 Message-ID: <406ee0c2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1081008322 24.239.150.17 (3 Apr 2004 08:05:22 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail