I am trying to run a jar file, which references some external JAR files that I am bundling up with the package. I am not able to download any dependency tools onto the system, so I am trying to do this using a manifest file.
The jar I am running is called attachmentUploader.jar
, and in the same directory is a libraries
folder containing the external jar files.
This is my MANIFEST.txt
file:
Manifest-Version: 1.0
Created-By: 1.6.0 (Sun Microsystems Inc.)
Main-Class: com.custom.test.postClient
Class-Path: attachmentLoader.jar libraries/java-json.jar libraries/org.apache.commons.httpclient_3.1.0.v20100508.jar libraries/org.apache.commons.logging_1.0.4.v3920100508.jar
Then I run this from the command line using:
java -jar "C:/Users/My Documents/attachmentUploader.jar"
but get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.methods.RequestEntity
at ......
Could not find the main class: com.tririga.custom.test.Tririga_postClient. Program will exit
There's a stack trace in there as well but unfortunately I am not able to copy across - if this turns out to be absolutely necessary to solve the problem I will laboriously type it!
The error message seems strange to me as there seem to be two errors - not being able to find a class within the httpclient jar and not being able to find the main class. I have checked and these are both there in the locations I have stated.
Have I missed something simple? Are the relative paths correct?