Jialong Xu
Jialong Xu

Reputation: 63

Java: In command line, Could not find or load main class

I tried to run DependencyParserDemo.java in Stanford NLP parser.

I use Win7, jdk-10.0.1.

In command line:

Javac -cp stanford-parser.jar DependencyParserDemo.java

Works fine, DependencyParserDemo.class generated.

But when I run:

Java -cp stanford-parser.jar DependencyParserDemo

It shows:

Error: Could not find or load mian class DependencyParserDemo
Caused by: java.lang.ClassNotFoundException: DependencyParserDemo

Maybe the classpath setting is wrong?

Upvotes: 0

Views: 67

Answers (1)

You also need the location of the new class in your classpath.

Java -cp stanford-parser.jar;. DependencyParserDemo

Upvotes: 3

Related Questions