This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I can't tell what that <attribute> element that tries to set the Class-Path of your manifest does, but it looks suspiciously as if it tries to put a library name there. If you want the manifest to refer to other jar files, its Class-Path entry has to be a list of those jar files. Just the name of the directory where those jar files are located isn't good enough. And beyond that you need the relative path from the executable jar to the referred-to jars.
And if you do "java -cp something -jar wotsit.jar", the -cp classpath parameter is ignored. The manifest has to be set up correctly.
Joined: Jul 30, 2005
With that then I guess my next question is an ant question: is there any way to have ant add the individual jars to the Class-Path in the manifest?
Am I overlooking an easier way to do this? It seems like a task that ant should be able to do...
Hi racarter, please change your name, it is not according to the JavaRanch policy.
When you have code in a JAR, you don't have to run it using the "-jar" option. You can also just put your JAR in the classpath and specify the class name of the main class on the command line. If you do it like that, Java doesn't tie you to the Class-Path attribute in the manifest file in your JAR file: