I've done similar things using properties files:
http://java.sun.com/j2se/1.4.1/docs/...roperties.html
Your installer can create a properties file in the user's home
directory (or some other well-known location) and then each time the
program starts up, it looks to that file.
Alternatively, you can set a Java system variable through the command
line that starts your application. For example, this set a variable
called 'fileLocation' to '/usr/local/random.conf':
java -DfileLocation=/usr/local/random.conf MyClassFile
Then, you access it your code using the System.getProperty(String)
method.
You would think Java would be able to interact with environment
variables, but I've never seen a clean way to do this.
-Nathan
na******@informatica.com (Naresh Agarwal) wrote in message news:<2b**************************@posting.google. com>...
Hi
I'm developing a server in Java. I need to read/write certain files in
my server code, for which I need the exact location of files.
In C++, normally this is achieved by having a system variable like
SERVER_HOME and using this variable in the code. This variable can be
set by Installer.
What is the way for achieving this in Java.
Also my server is actually a web-app which will run in some app
server.
thanks,
Naresh