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.

enter a description of the image here

What is the problem?

Author: Padawan, 2018-09-08

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) BuildRebuild Project. Sometimes Intellij doesn't rewrite classes because they already exist, so you're asking Intellij to rewrite everything.

2)RunEdit configuration → delete profile → add profile ("Application" if this is a Java application), select the main class from the "Main class"drop-down menu.

3)BuildRebuild Project.

Another way - Close your IntelliJ IDE and delete the IntelliJ IDE file and folder(.idea) from the project root:

 9
Author: Anton Sorokin, 2018-09-09 05:07:49