-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAVA "Error: Could not find or load main class main" - SOLVED in CMD (W10), add solution to atom-script #1470
Comments
you need to make your main class public |
Reinstall JDK |
Its already public!!! |
+1 Error: Could not find or load main class sun.applet.AppletViewer Process finished with exit code 1 |
did every thing but still giving error "could not find or load main class" |
For me, my current solution is to use the |
Edited the source code so that the command now is and it still gives me the error. Copying that exact command into the terminal does not give me that error. So what is the problem? |
Should be fixed in #2470. Let me know if it is not. |
I made a test file "main.java":
--------------------------- start ---------------------------
import java.util.;
import java.lang.;
import java.io.*;
class Test {
public static void main (String[] args) throws java.lang.Exception {
System.out.println("test");
}
}
--------------------------- end ---------------------------
I got an error:
"Error: Could not find or load main class main"
Solution 1 - filename should have the same name as class, so renaming file to Test.java can fix that.
but
Solution 2 - in Windows 10 x64 cmd.exe, when you run command "java -cp . Test" or java -classpath . Test" everything works, because it also looks in local directory.
If you add to classpath ".;" ( c:\Program Files\Java\jre1.8.0_152\lib\rt.jar;. ) in cmd.exe command "java Test" starts to run and everything is ok.
However in atom-script still throws error "Error: Could not find or load main class main".
Could you fix it?
The text was updated successfully, but these errors were encountered: