Reputation: 7569
I am trying to run testjar.jar , that depends on ConnectionException class residing in wsc-22.jar
Both jar is in the same folder.
What's wrong with bellow command..? (It is working well in Eclipse, i just exported into testjar.jar)
Thank you ..
lib > java -cp ./wsc-22.jar -jar testjar.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/sforce/ws/ConnectionException
Caused by: java.lang.ClassNotFoundException: com.sforce.ws.ConnectionException
Upvotes: 0
Views: 3017
Reputation: 51535
You cannot use -cp (nor -classpath) along with -jar
do java -cp ./wsc-22.jar;testjar.jar my.package.Main
substitute the above accordingly
Another option is to add wsc-22.jar in the testjar.jar manifest file.
For instance in testjar.jar:
MANIFEST.MF
Manifest-Version: 1.0
Main-Class: my.path.to.the.main.Application
Class-Path: wsc-22.jar
Upvotes: 4