Reputation: 51
I am trying to run a java program in linux server which includes an imported jar. While compiling it is not giving any issues , but when I try to run, it is giving an error "Error: Could not find or load main class ". If I remove the import and its references , my code is working fine without any load issues. Any inputs please
javac -cp "/opt/CARKaim/sdk/pwdsdk.jar" SamplePwd.java //No issues
java -cp "/opt/CARKaim/sdk/pwdsdk.jar" SamplePwd //Error: Could not find or load main class
Upvotes: 1
Views: 185
Reputation: 201399
Assuming SamplePwd
has an entry-point (e.g. main(String[] args)
) make sure the current folder is also in your class-path, like
java -cp "/opt/CARKaim/sdk/pwdsdk.jar:." SamplePwd
Upvotes: 1