0

I am having trouble getting my main method to run, and I get the following error message in Eclipse:

 Error: Could not find or load main class CLASSNAME

I'm afraid it is some problem with my JRE setup or CLASSPATH variable. Many other threads suggest checking the ".classpath" file for absolute paths, however all my paths in this file are relative.

The JRE I am trying to use is "jre7" in "C:\Program Files\Java\jre7". My CLASSPATH environment variable reads: .;"C:\Program Files\Java\jre7\bin"

What could be the problem with my project/environment setup? For some reason all other projects in my workspace still run properly.

Joshua Dwire
  • 5,415
  • 5
  • 29
  • 50

1 Answers1

0

I do not thing there is anything wrong with your JRE or CLASSPATH variable if all of your other projects are still working.

This may not be the only cause, but I just went and set up a project, created a class with a main method, and ran it once. Then I went and renamed the class, and tried to start it again. The run configuration still had the original name, so it could not find the main method, and threw that same error. Fixing the run configuration or creating a new one should fix it.

If this is not the case for your application, could you please provide additional information about the run configuration and main class you are using for that specific project?

Pandacoder
  • 708
  • 7
  • 11