Cannot start main class in Intellij

I have the following project structure

-ProjectRoot ---src ------Main ------examples ---libs 

My src folder is marked as sources in Intellij.

Now, when I want to run the Main class, I get the following error:

 Exception in thread "main" java.lang.ClassNotFoundException: Main 

Any ideas on what I'm doing wrong?

Here is my main class:

 public class Main { public static void main(String[] args) { System.out.println("hello world"); } } 

There are no package operators in it.

+5
source share
1 answer

Clean the project, edit the run configuration, select the main class again. This might not be necessary if you have a src/main/java structure.

+6
source

Source: https://habr.com/ru/post/1258284/


All Articles