How to Create a runnable jar that uses external jar files in dynamic locations
I've programmed an application that take about 300 kilobytes. The jar files that it uses (library) take about 10 megz.
These library jar files are used in other applications I wrote and so I would like to have them located in an external central location (Meaning - A path on some hard drive in the same computer). Hopefully, the path of the library files can be defined by a system environment variable.
I looked for good solutions to this issue and couldn't find something solid. I'm guessing the solution will include an ant build and perhaps some alteration to the MANIFEST file. Tried to do this, but to my understand, a class-path in the manifest file cannot contain variables of any kind.
Thank you in advance!
EDIT: After discussing this with kind people below. I now use the following command prompt. Still doesn't work.
Pay attention that you can not use -cp and -jar at the same time. When you do java -jar, java expects the referenced jar to be declared inside the MANIFEST.MF file. I think your command line should work putting your jar inside "cp", and calling explicitely the main class on the command line.
Another solution if you are concerned with the size is to deploy your application with JNLP and compress your jars with Pack200.
Just set your CLASSPATH environment variable to point to your .jar s. Or pass -classpath option to java.
Here is how to do it under windows