7

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.

3 Answers3

6

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\
Rakesh
  • 4,264
  • 4
  • 32
  • 58
  • 1
    Dear Rakesh i applied your solution for the setting configuration and now it works for me . I am Really thankful to you for this favour. – Syed Muhammad Mubashir Mar 14 '12 at 11:10
  • Well, that is why I am here on SO ! :-) – Rakesh Mar 15 '12 at 04:49
  • Your solution is working for some exception but now i am getting another exception as below and i am applying both of the solution but now both of the solution is not working for me – Syed Muhammad Mubashir Mar 16 '12 at 08:07
  • i found that by running javac -version i found that javac 1.7.0_02 was installed in my system now please tell which of the 3 i may install 1)Java EE 6 SDK with JDK 7 U3 2)Java EE 6 SDK 3)Java EE 6 SDK Web Profile ots of thanks in advance – Syed Muhammad Mubashir Mar 17 '12 at 02:43
4

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.

Community
  • 1
  • 1
npinti
  • 51,780
  • 5
  • 72
  • 96
  • No this is not third party application and i am just creating a swing project using NetBeans and i create the application which has public static void main(String[] args) function , even with the presence of main function i get this exception some time and unable to execute and most of time my application works fine. – Syed Muhammad Mubashir Mar 14 '12 at 10:13
  • @Prog_Anila: I have modified my answer. Hopefully what I said will solve your issue. – npinti Mar 14 '12 at 10:25
0

the solution is,right click your package in netbeans,go to properties,source now go to the jre option and choose your version,the programme will now run.

Chathuranga Chandrasekara
  • 20,548
  • 30
  • 97
  • 138
attah
  • 1