• Entries (RSS)
  • Comments (RSS)

java.lang.NoSuchMethodError “main” with Eclipse

Posted by | Posted in Eclipse | Posted on 15-07-2008

Tagged Under : ,

java.lang.NoSuchMethodError “main”. This was the exception one of colleague got when he tried to run a simple java application from within Eclipse. The java file that we were trying to execute had a main method and its syntax also matches with what Java wants.

For resolving this issue we tried to execute the file using different options like Run, Run As Java Application…. None of these methods helped us in resolving the issue. Then we thought its some problem with classpath and we couldn’t see anything wrong in our classpath settings.

Then we thought something wrong with our .metadata directory. We just closed our Eclipse and deleted the .metadata directory and started Eclipse again. Eclipse started with no projects. Since these projects were already in we just imported the projects using ‘Import existing project’ option of Eclipse. This time when we run the program, Eclipse was able to find the main method without any issues.

Yes there was something wrong in his .metadata directory and I still don’t know what it is.

Share

Read More

Post a Comment