Tried cleaning projects and giving multiple builds but I am getting "Error: Could not find or load main class".
But I am getting the error when I am running Application.java class
Please help me out.
I faced the same issue..
just do follow these steps:
STS --> Project --> Enable "Build Automatically"
then refresh your project, it will resolve your issue.
Still not refreshed your projects automatically, just restart your STS and check.
Hope it will help you. Happy reading.!!!
Look at the problems tab and see some of the jars under .m2 might be complaining. In my case spring-boot-autoconfigure jar was a problem.
navigated to user C:\\Users[your user].m2\\repository\\org\\springframework\\boot
renamed folder spring-boot-autoconfigure
right click on project go to maven
click update
and problem disappears
some solutions suggest that the main class not found problem occurs due to any conflicting jar or corrupted jar file which is true but unfortunately as long as I found they suggest to remove .m2 folder altogether. Though it may resolve the issue but is time consuming because all the dependencies will be re-downloaded.
That's why I was running after to find where is the root cause and problems tab which appears along side the console tab in STS and Eclipse helps.
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.