This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm having a problem getting an application to run when packaged as an executable Jar file (java -jar MyJar.jar).
The application needs to reference an external Jar file (javamail-1.4's mail.jar). When I include that Jar on the Class-Path attribute of the Manifext.mf file, then I get a ClassNotFoundException on my main class. Without the class-path entry, my main class is found just fine (but of course it can't find the javamail stuff...).
First, here is the structure of my application's Jar file:
Here is the contents of my meta-inf/Manifest.mf file:
When the Manifest.mf file includes a Class-Path entry, is there something special I need to do to get the classes in my Jar on the class path as well?
I'm assuming I'm doing something silly, but after pouring over several tutorials/examples, I just don't see it.
Mark E Hansen
Joined: Apr 01, 2009
Well, I decided to try copying the external jar into a directory relative to the location of my application's Jar file and changing the Class-Path entry in the Manifest.mf file accordingly, and it now works. Perhaps the Class-Path entry of the Manifest.mf file can't accept full-paths (or Windows full-paths)?
If there's a way to have my application refer to an external Jar that is referenced via a full Windows path, I would sure appreciate knowing how to do it. I would rather not make copies of the external Jars if I can help it.