Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find or load main class Swing Java

Error: Could not find or load main class jewelleryerpapplication.GUI.ERPMainMenu Java Result: 1

Actually i am using Net Beans 7.1 and in that i am continuosly getting the same error but un able to get the solution for that even after installing the latest update for that. The solution which i got from some body that create new project and copy the source and library foldes in that Project from the previous which generate the above error. this solution works for me but i need some simpler solution for this problem.Lot of thanks in advance. Don't Forget To Give UpVote It If It Helps.

like image 822
Syed Muhammad Mubashir Avatar asked Mar 14 '12 09:03

Syed Muhammad Mubashir


2 Answers

Right click on project node, go to Set configuration, select the main class for your application. Then clean and build.

Even if this doesn't solve your problem, then delete the Netbeans cache by deleting the (index) folder

User\.netbeans\6.9\var\cache\index\
like image 95
Rakesh Avatar answered Sep 22 '22 20:09

Rakesh


I think that the following is happening:

  • If this is a third party application, you have not included some jar files on your class path;

  • Or, (which in my opinion is the most likely) you do not have a method which has this signature: public static void main(String[] args). This method defines the main entry point for your application, not having it might cause that error when you try and run the project. To my knowledge, Netbeans creates a main class with such a method automatically whenever you create a new project. This might be the reason why you are not having this exception when you create a new Project and throw everything in it.

  • You might be having an issue with Netbeans itself. You can start by either checkin gout this previous SO thread in which a similar (I think) issue is being discussed, or else, as a final resort, you might want to remove Netbeans and all its files, and install an earlier version. You can also try and see if you get the same issue if you use a different IDE such as Eclipse.

like image 25
npinti Avatar answered Sep 23 '22 20:09

npinti