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
Try to point the classpathentry output path in the .classpath
file to target/classes
The classpath file is located in the project folder. Edit it manually.
In my case, it was like this before:
classpathentry kind="output" path="bin"
I changed it to:
classpathentry kind="output" path="target/classes"
I ran into the same error today, I refactored my project name and then refactored it back to the old name and it ran just fine after that.
I was also getting same message.That is due to the workspace problem.Create one new workspace and try there once. I think it will works.
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
I came across the same problem. You might get this error in many situations like below.
mvn clean
, mvn build
and other options.Here, the list of hit and trial goes on. Believe me the tool Eclipse is not that stupid. It is quite smart to find errors even at compile time. I tried all ways mentioned above, but none worked for me.
The main problem which worked for me was JRE version which was somehow got set to default (JRE System Library [jre1.5]). I reset it to jre1.8.* which I had installed in my machine.
I don't commit that this is only the solution to this problem but yes this could be one of the solution. So keep an eye on JRE version.
I was having the same problem. I was having a maven project. According to my knowledge, it was because i had cleaned the project and there were no class files generated. I did mvn compile and it was started running.