Could not find or load main class in STS/Eclipse

Project -> Clean

this is working


Try updating project by right clicking on it. Maven -> Update Project


Today I ran into the same problem and I tried a lot of answers. Nothing helped. Cleaning the project, build automatically is already checked, deleting .metadata, etc.

Eventually I tried this and it worked perfectly:

menu Project -> Properties
Java Build Path, tab Libraries

Remove the JRE System Library from there, press Add Library, take the JRE System Library and press Next. Workspace default JRE and press Finish.