Reputation: 2619
When I compile the following, it compiles and creates a .class file. It works
javac -classpath abc.jar Abc.java
But when I run the following:
java -classpath abc.jar Abc
It gives this error:
Error: Could not find or load main class
I am using a cmd on windows 7. It works with a basic helloworld example but not with others.
Upvotes: 1
Views: 695
Reputation: 240928
it overrides classpath so again you will have to add current directory to classpath
java -classpath abc.jar:. Abc
Upvotes: 3