I know there are many posts on this. I have tried the advice on those threads.
Could not find or load main class
What does "Could not find or load main class" mean?
I compile a class like this... (it creates a NER_Sample.class file)
javac -cp "jar1:jar2:nlp:" NER_Sample.java
Then I try to run it like this
java -cp "jar1:jar2:nlp:" NER_Sample englishPCFG.ser.gz parser/data/testsent.txt
I get Could not find or load main class NER_Sample
NER_Sample has the declaration package nlp;
But this gives the same error
java -cp "jar1:jar2:nlp:" nlp.NER_Sample englishPCFG.ser.gz parser/data/testsent.txt
What do I try next?
Use -Xdiag
It can happen the message Could not find or load main class NER_Sample
really means the class is found but can not be loaded, since there are other referenced classes that are not found on classpath.
java -Xdiag
will tell you more, such as what classes are missing next.
Add the current directory to the runtime classpath
java -cp .:jar1:jar2 nlp.NER_Sample englishPCFG.ser.gz parser/data/testsent.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With