Excelsior Forums

Unable to load ini files as command line args

Recommended Posts

Posted (edited)

I gather this is a classpath problem...

I have the following directory structure.

• myapp.exe
• /config
• /config/settings.ini

The config directory is not part of the excelsior jet's class path so files contained within cannot be loaded. I would like to add it during runtime to the class path using a batch file which seems to be the easiest way from what I've read. Using the JETVMPROP environment variable this should be doable. However anytime I modify it I get errors that it cannot find the applications classes. So I think I'm blowing away the existing class path. I've tried things similar to

set JETVMPROP="-Djava.class.path=%CLASSPATH%./config"

Still no dice however. I've tried variations using ; delimiters and fully qualified paths C:\\path\\to\\my\\config.. Still no dice.

I am using the Excelsior Jet Maven plug in to copy the files during compilation into the config directory.

<packageFiles>
<packageFile>
<path>src/main/external-resources/Config.ini</path>
<type>file</type>
<packagePath>config</packagePath>
</packageFile>
</packageFiles>

It is important the configuration files are not part of the compilation as I don't want them to be compiled into the jar file and then the exe. I want to have them external so I can modify them without the need to do another lengthy recompilation of the application. So even within the Java app themselves they sit outside the classpath, only in my development profile do I include them in the Netbeans classpath. Whats the point of a configuration file if you have to always recompile.

Even placing the configuration file in the same directory as the exe, it still can't find it.

Without Excelsior I can add the config directory to the classpath and run it just fine using the following command. Loading three separate ini files into the project via command line args.

java -classpath pidx-1.0-jar-with-dependencies.jar:/Path/To/NetBeansProjects/com.lht.pidx/target/config com.lht.pidx.PidxApplication Config.ini Development.ini To_Local_Database.ini

Any help, pointers or tips on how to resolve this would be greatly appreciated.

Edited by zabquart
Clarified the problem