Error: Could not find or load main class intellij Idea
The program returns this error when it starts. Registered in the commander klasspas
C:\Users\yuri>cd\
C:\>set path="C:\Program Files\Java\jdk1.8.0_171\bin"
C:\>set classpath="C:\Program Files\Java\jre1.8.0_171\lib\rt.jar"
C:\>
I attached a screenshot with the program.
What is the problem?
1 answers
By Tsyklop:
You must explicitly specify the startup class:
java -cp App.jar Display.class
. System variables have nothing to do with it.
If that didn't help, here are some more ways(from of ' s response to enSO):
1) Build → Rebuild Project. Sometimes Intellij doesn't rewrite classes because they already exist, so you're asking Intellij to rewrite everything.
2)Run → Edit configuration → delete profile → add profile ("Application" if this is a Java application), select the main class from the "Main class"drop-down menu.
3)Build → Rebuild Project.
Another way - Close your IntelliJ IDE and delete the IntelliJ IDE file and folder(.idea) from the project root: