Skip to main content

java tool with config file

2 replies [Last post]
Joined: 2005-02-24

I know that this might be a newbie thing, but I have not found any documentation regarding it when looking at the tool docs for the java/javaw command:

Is it possible to pass a command / set an environment variable so that numerous parameters can be set in a file instead of a very lengthy sequence of -D parameters.

First of all, it would be useful to put all the -Dfoo=bar options on seperate lines in a file for environmental reasons, as companies have different environments (e.g. development, testing, pre-live, live), and it would be good to support a different environment via different configuration files.

Enterprises can use very lengthly classpaths, and one idea would be to separate the classpath (mainly for coherence) by having a (boot classpath append/prepend) (classpath append/prepend) command on each line.

Is there any basic support for config-file based launching of java? I consider this a very important point for serious businesses.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-02-23

The best that you can do is set the CLASSPATH enviroment variable. Everything else needs to be set in the command line.

Another option is to start the Java VM from inside an executable wrapper using JNI. The executable wrapper just handles the command line and enviroment and then executes the JMV.

Joined: 2004-07-12

The best way I can think of achieving what you are trying to do is by using a properties file. (

You could also pass a command line flag to your application to use different property files for different modes.

e.g. The Netbeans IDE uses a netbeans.conf file which is a properties file to pass in default runtime options to the JVM and some other properties which it needs.