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
I had the same problem. In my case I did the following, to resolve it.
Observation: The classes directory in my case was not created, which means that the javac failed. On command line also, javac works the same way, if you have multiple java files in the same invocation of javac, and one java file encounters a problem, then no class files are created.
Which means Eclipse puts all the java files in the project with single invocation of javac.
Now if there are no class files generated, obviously, the message now makes sense. The compile errors are also shown in the "Problems" pane.
Now this would be the case if there is a compile error. If just a jar file which is not used at all, is on the classpath, there should not be any problem.
Even if my project had problems, I ignored it, because I was just testing a single class, and was thinking that only that file would get compiled and run, because it was a standalone test, without any dependencies.
But that is not the case with Eclipse. I wish they did it that way. As you can see lot of people got burnt this way.
Thanks