Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Error: Could not find or load main class [duplicate]

Tags:

java

eclipse

Have Googled extensively on this error, but I can't seem to fix the problem. I've written a basic java program in Eclipse Juno, as follows:

public class HelloWorld {      /**      * @param args      */      public static void main(String[] args) {         System.out.println("Hello Eclipse!");     }  } 

After clicking Run, I get: "Error: Could not find or load main class HelloWorld". This error message applies to all my other projects in the same workspace. I've tried switching workspaces but the error still appears.

I'm on Windows 7 64-bit. Any help would be appreciated!

like image 484
Fezzo Avatar asked May 02 '13 09:05

Fezzo


People also ask

What is the error could not find or load main class in Java?

When you get the message "Could not find or load main class ...", that means that the first step has failed. The java command was not able to find the class. And indeed, the "..." in the message will be the fully qualified class name that java is looking for.


1 Answers

This just happened to me today after updating my JRE. I cleaned the project and it started working again.

Project -> Clean will remove any existing class files and completely rebuild the project. There's more information on Eclipse's clean function here.

like image 199
Nathan Avatar answered Oct 31 '22 01:10

Nathan