Why not use a Properties file which you can get the class loader to locate
for you using call similar to:

properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("/myfile.properties"));

Just place the file at the root level of your (web project) source tree,
so that it is copied either to WEB-INF/classes or built into a jar file
placed in WEB-INF/lib when your app is deployed.

Make sure that the path to the file matches the directory (or package
folder) that you place the properties file in.

This technique works fine with Tomcat, or with a regular java app.

John Sidney-Woollett

Giorgio Franceschetti said:
> Hi all,
>    I'd like to create a file with some configuration details for my
> application.
> I tryed to reference my file like this "./data.txt" and I found it in my
> tomcat/bin directory.
> Well, I should  have expected this, quite like any other java
> application points to the executable directory.
> Is there any way to point to my application directory?
> Should I assume a fixed path like tomcat/webapps/myapp    ?
> Thanks in advance,
>     Giorgio
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to