This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I've packaged up a jar file with my classes and libs neatly placed in their directory structure. I've created a cmd file that will be used to call the main method of the application to start the application. I'm having trouble adding the libs within the jar to the classpath so my application can find and use them. Here is the code from my cmd file.
I know the SystemStart path is correct and that it takes an argument. When I run this script it gives me this.
Which tells me it isn't finding the lib files (the JavaMail jar files). Does anyone know the syntax for my classpath to add the jar files from inside my application jar file? Thanks for your time.
James, It's easier if you make your jar file "executable" by adding this line to the META-INF/MANIFEST.MF file inside the jar: Main-Class: com.home.rptsendmail.v2.SystemStart and then run it with: java -jar RptSendMail-2.0.0.jar see The Jar File Tutorial If you want to ship the javaMail stuff alongside your jar, use the manifest's Class-Path: entry like this (this may not be permissible by Sun though, so check the license carefully)
Download extensions are specified in the Class-Path header field in the manifest file of an applet, application, or another extension. A Class-Path header might look like this, for example: Class-Path: servlet.jar infobus.jar acme/beans.jar With this header, the classes in the files servlet.jar, infobus.jar, and acme/beans.jar will serve as extensions for purposes of the applet or application. The URLs in the Class-Path header are given relative to the URL of the JAR file of the applet or application.
Otherwise, just unjar all the classes you need and bundle them directly in your .jar (no nested jar files).