Reputation: 7107
I'm trying to execute my JAVA
app on a Linux
OS where the necessary jars are located in a different folder. How can I execute my project using the external jars?
project location:
$ pwd
/root/MyApp/bin
$ ls
Deletion.class
jars location:
/opt/jars/*.jar
My failed execution:
$ java Deletion
... NoClassDefFoundError ...
$ java -cp "/opt/jars/*.jar" Deletion
Error: Could not find or load main class Deletion
Upvotes: 0
Views: 41
Reputation: 20658
When setting the class path with -cp ...
, you have to also specify the current working directory (as this is not part anymore):
java -cp ".:/opt/jars/*.jar" Deletion
Upvotes: 1