0

I want to execute jar in command line, but I can't solve how to add third party jar in classpath. Now the third party jar are in the current directory.

java -cp `pwd`/args4j-2.0.6.jar:`pwd`/commons-lang3-3.3.2.jar -jar eval.jar 

I still get the ClassNotFoundException which indicates that the JVM can't find the third party jars.

2 Answers 2

1

Something you can also try is to extract the jar and modify the MANIFEST.MF file to add the third party jars to Class-Path and zip the folder back and rename the extension to .jar.

Also you can refer the below for other ways to modify the manifest.

Sign up to request clarification or add additional context in comments.

Comments

0

you could always open cmd, and navigate to where you have the jar and execute it like you would execute a programrunning a jar

or add it to your env path: system->advanced system settings->advanced->enviromental variables: then add a ";" at the end followed by the directory where your jar is: adding env variables

^after this you can execute it like you were before.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.