IDEA error cannot find or load the main class (perfect solution)

Preface

When running the project today, an error occurred suddenly: IDEA error cannot find or cannot load the main class

Problem report

Could not find or load the main class

This is how the CSDN big guys solved the
error: the main class could not be found or could not be loaded.
Guess: 1, failed to compile successfully;
try: menu—"Build—"Rebuild Prodject
result: start the service and still report the same error
2, cache problem ;
Try: Menu—"File—"Invalidate Caches/Restart Select Invalidate and Restart or just Invalidate, clear the cache, and then Rebuild Project.
Result: Successful startup, problem solved

solution

file—>Project Structure
Insert picture description here
Click on Moudles in Project Settings—>click on the minus sign to delete all Moudles
Insert picture description here

Click on the + sign to re-introduce Moudle
Insert picture description here

Find the pom file in the parent folder of the project—>OK
Insert picture description here
Rebuild Project is a
Insert picture description here
perfect solution
Insert picture description here


Write at the end

The reason for this problem may not stop there. I hope that friends with different opinions will discuss (si) and (bi) in the comment section!

Guess you like

Origin blog.csdn.net/l_mloveforever/article/details/112725753