无法找到或加载主类Swing Java

时间:2021-01-22 15:58:01

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

错误:无法找到或加载主类jewelleryerpapplication.GUI.ERPMainMenu Java结果: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.

实际上我正在使用Net Beans 7.1,因为我不断获得相同的错误,但即使在安装了最新的更新之后也无法获得解决方案。我从一些创建新项目的主体获得的解决方案,并从之前的项目中复制源项目和库文件,产生上述错误。这个解决方案适合我,但我需要一些更简单的解决方案来解决这个问题。提前谢谢。如果它有帮助,不要忘记放弃投票。

3 个解决方案

#1


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;

    如果这是第三方应用程序,则您没有在类路径中包含一些jar文件;

  • 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.

    或者,(在我看来最有可能)你没有一个具有这个签名的方法:public static void main(String [] args)。此方法定义应用程序的主入口点,而不是在尝试运行项目时可能导致该错误。据我所知,Netbeans会在您创建新项目时自动创建一个具有此类方法的主类。这可能是您在创建新项目并将其中的所有内容都放入时不会出现此异常的原因。

  • 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.

    您可能遇到Netbeans本身的问题。你可以先检查一下之前正在讨论类似(我认为)问题的SO线程,或者作为最后的手段,你可能想要删除Netbeans及其所有文件,并安装早期版本。如果使用不同的IDE(如Eclipse),也可以尝试查看是否遇到同样的问题。

#2


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

即使这不能解决您的问题,也可以通过删除(索引)文件夹来删除Netbeans缓存

User\.netbeans\6.9\var\cache\index\

#3


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.

解决方案是,右键单击netbeans中的包,转到属性,源现在转到jre选项并选择您的版本,程序现在将运行。

#1


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;

    如果这是第三方应用程序,则您没有在类路径中包含一些jar文件;

  • 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.

    或者,(在我看来最有可能)你没有一个具有这个签名的方法:public static void main(String [] args)。此方法定义应用程序的主入口点,而不是在尝试运行项目时可能导致该错误。据我所知,Netbeans会在您创建新项目时自动创建一个具有此类方法的主类。这可能是您在创建新项目并将其中的所有内容都放入时不会出现此异常的原因。

  • 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.

    您可能遇到Netbeans本身的问题。你可以先检查一下之前正在讨论类似(我认为)问题的SO线程,或者作为最后的手段,你可能想要删除Netbeans及其所有文件,并安装早期版本。如果使用不同的IDE(如Eclipse),也可以尝试查看是否遇到同样的问题。

#2


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

即使这不能解决您的问题,也可以通过删除(索引)文件夹来删除Netbeans缓存

User\.netbeans\6.9\var\cache\index\

#3


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.

解决方案是,右键单击netbeans中的包,转到属性,源现在转到jre选项并选择您的版本,程序现在将运行。