Error: could not find or load the main class - Java cygwin

Using cygwin on windows 7.

To compile all my files, follow these steps:

javac -cp ./antlr-3.2.jar *.java 

which works great. Then i try

 java -cp .:./antlr-3.2.jar Interpreter 

where the interpreter is a .java file, which, as I know, is in the current directory. I thought adding . in pathpath will fix my problem but i still get

 Error: Could not find or load main class Interpreter 
+7
source share
1 answer

Despite the fact that you are working under cygwin, java.exe is still a Windows program.

He needs ; as a class path separator. Try

 java -cp ".;./antlr-3.2.jar" Interpreter 

or

 java -cp .\;./antlr-3.2.jar Interpreter 

You need to avoid or quote the class path correctly so that it is not interpreted by the shell.

+19
source

All Articles