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/Config.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

##### Share on other sites

Going to bump this. Is this even possible?

##### Share on other sites

"When you prepare the application for deployment using the JetPackII tool, the same problem can arise again. Typically, this happens for resource files that reside in directories, not in jar/zip files /The JET Optimizer packs resource files located in jar/zip classpath entries into executable by default. Thus, generally there is no way to forget them to include to the deployment package unless you decided to leave those jar/zip files separate from the executable./ . Classpath entries that are directories are always left separate from executable with all contained resource files. Using JetPackII, you have to add such directories to the package and assign them to respective classpath entries."

Can this be done with ExcelsiorJet Maven plugin?