Reputation: 2933
There are some encoding character in my code so I compile the code as follow:
javac -cp cayenne-2.0.4.jar Twokenize.java
It's ok. But when I run the program, it return an error:
java -cp cayenne-2.0.4.jar Twokenize test.txt
Here is an error:
Error: Could not find or load main class Twokenize
But when I just run:
java Twokenize test.txt
The program (main method) still runs smoothly util it meets the code that require external library. Please help me. Thank you very much.
Upvotes: 2
Views: 1410
Reputation: 240948
when you use -cp
it looses current directory from classpath so you need to specify explicitly
Use
java -cp .:cayenne-2.0.4.jar Twokenize test.txt
Upvotes: 6