Article View: borland.public.jbuilder.java.language
Article #7479Re: Locating an INI file
From: Torsten Welches
Date: Thu, 21 Jun 2001 05:57
Date: Thu, 21 Jun 2001 05:57
21 lines
1866 bytes
1866 bytes
"Mio Nino Marquez" <mionino[nospam]@apsilontech.com> wrote:
>So I guess my question is, how do I know the location of the
>class / package? Code snippets would definitely be helpful.
>
>PS: In Delphi I can use the ExtractFilePath
>(application.exename) to get the location of the exe file. i'm
>looking for something similar in java.
Java has no consistent notion about an "application path", but
System.getProperty("user.dir"); returns the user directory. You
could store your files there. You could also set an application property with a -D VM parameter. And finally you could get your
file using the main class' classloader with something like
mainClassInstance.class.getResourceAsStream("foo.ini");
BTW - ini files are a Windows-only concept, the Java equivalent
are property files:
http://java.sun.com/docs/books/tutorial/essential/attributes/index.html
Torsten
Technical Details
Message-ID:
<3b318ce2$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!netnews.com!feed2.news.rcn.net!rcn!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b317205_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,52be12fbe909d3e9 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-20 23:09:21 PST From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Subject: Re: Locating an INI file Newsgroups: borland.public.jbuilder.java.language X-User-Info: 193.158.55.74 193.158.55.74 References: <3b317205_1@dnews> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3b318ce2$1_2@dnews> Date: 20 Jun 2001 22:57:54 -0700 X-Trace: dnews 993103074 207.105.83.65 (20 Jun 2001 22:57:54 -0700) Lines: 23 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!netnews.com!feed2.news.rcn.net!rcn!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews