1

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
Filburt
  • 16,951
  • 12
  • 63
  • 111
maverick
  • 51
  • 2

1 Answers1

1

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
Elliott Frisch
  • 191,680
  • 20
  • 149
  • 239