I know there are many duplicates of this question, but I have looked at them all, and none of them have solved the issue.
I am trying to run a class that has a main
Removing the JRE System Library and adding the default one worked for me.
Usually cleaning and rebuilding the project from Eclipse does the trick.
However, when using Maven I have discovered times this does not work and I've noticed the 'target' folder of my maven project does not have anything under it. Running 'mvn clean install' from the command line and refreshing the project in eclipse does the trick.
I faced the similar problem, a workaround is to open up a terminal, go to project folder and run
java cp target/<your_jar_artifact.jar> <com.your_package.YourMainClass>
I was getting the same message and I solve the problem moving out two dependencies from my pom.xml called "org.slf4j". After that It worked perfectly!
I followed several of the less drastic suggestion here to no avail. Then it dawned on me that Eclipse was confused because I had made a backup copy of my src project folder. (It was compiling all these "copy of" folders' *.java files and I noticed the subfolders for them in my bin folder.) I moved the backup elsewhere, got rid of the extraneous class files, did a Project > Clean, and everything was back to normal.
Found This while searching, and it was after I updated my Java that the problem seemed to occur.
In Eclipse from your project:
Right-click on your project
Click Properties
Java build path: Libraries; Remove the "JRE System Library[J2SE 1.4]"
Click Add Library -> JRE System Library
Select the new "Execution Environment" or Workspace default JRE