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
  • 17,626
  • 12
  • 64
  • 115
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
  • 198,278
  • 20
  • 158
  • 249