Wednesday, 29 April 2015

Error: Could not find or load main class

This is the common issue with Eclipse , even I faced many times . This is not related to Eclipse or any other IDE tool.

This issue occurs when you are trying to run your main() method with respective class, its looking for the exact .class file in the class path.During the execution the .class file is not available in the class path. The best way to resolve this is, add the .class file into classpath.

There are many possible diagnosis you can do in your Eclipse for this issue. As per the Eclipse behaviour when you are updating the classpath (Build Path) , your class is getting compiled that time and the .class file got created. So, Be careful when doing the build path for your project.

Also check your Build Path, if any jar file is missing. Because, its might causes sometime.

In my case I just found the jar file missing in the build path , and I removed the missing jar and added new jar file from other location.Then executed my class with main method and it works. Below screenshot shows my issue.............

Hope it will help you.

Follow for more details on Google+ and @Facebook!!!

Find More Issues & Solutions -

No comments:

Post a Comment