0

I try to run or debug program using play/debug button in IntelliJ and I got Error: Could not find or load main class

I've done a lot of things from Spring Boot Program cannot find main class did not work. But when I use command line and run: mvn spring-boot:run app is running and works perfectly fine.

My main method is below:

@SpringBootApplication
public class HomeworkApplication {

    public static void main(String[] args) throws IOException {
        SpringApplication.run(HomeworkApplication.class, args);
        JsonData jsonData = new JsonData();
    }
}

I just want to run and debug via IntelliJ.

derirative23
  • 486
  • 2
  • 7
  • 22

2 Answers2

0

Try out these steps:

  • Goto File | Project Structure, or press Crtl+Shift+Alt+S
  • Select Modules under the Project Settings section.
  • In the Sources tab click Sources on the 'Mark as:' line.
  • Click the Apply button.
Dark Knight
  • 8,218
  • 4
  • 39
  • 58
0

Try this out: Go to Edit Configuration on your main class, then go below the Before launch: Build, Activate tool window part and click + button and add Build if it's not added.

careful
  • 69
  • 8