fscore
fscore

Reputation: 2619

Error: Could not find or load main class on running the java file

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

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240928

it overrides classpath so again you will have to add current directory to classpath

java -classpath abc.jar:. Abc

Upvotes: 3

Related Questions