`

could not find the main class,program will exit

阅读更多

前几天帮一个同事看了这个错误,现在总结 一下:

错误的主要原因是没有生成class文件,所以运行的时候会报这个could not find the main class,program will exit找不到这个class类,所以以后同学遇到这个错误先检查是否正常生成class文件,如果正常生成class文件却运行不了说明是jdk版本的问题这个解决方案我就不多说了,如果没有生成就按照下面这三点去检查一下项目:

1.如果项目里引了某个不用的jar包,而那个包又被你删了,就会出现不报错但怎么也编译不出来class文件的情况,可以把所有包都删除,然后一个一个的再引入(需要的),不要一下子把所有包都引入来,没用的可能会引起不良后果.
2.想删掉某个class文件重新生成,删除class文件后,但classes目录下的文件夹被其它程序打开,比如Total Commander。此时编译也不会通过,在problems下可能会提示“con't delete classes ……”。关掉其它程序重新编译即可。

3.还有种情况是remove掉 JRE System Library,重新导入即可编译。但是什么原因导致的还不清楚。

分享到:
评论

相关推荐

    解决 Can not find the main class. Program will exit. 难题

    解决 Can not find the main class. Program will exit. 难题

    java打jar包的方法

    解决Could not find the main class, Program will exit的错误的方法

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The TFlexPanel.FPaintCache field moved in the protected class section. Added rcPaint field in FPaintCache that represents drawing rectangle. - ADD: In the text prcise mode (TFlexText.Precise=...

    androidandroidandroid

    androidandroidpublic class first_Java { /** * @param args */ public static void main(String[] args) { ...則Could not find the main class: first_Java. Program will exit. 因為檔名要一樣才行

    eclipse 下打包

    的错误 <br>如果没有使用其他插件啊,类库等,以上的步骤就可以了 但如果用了,例如我用了SWT,就麻烦一点了 如果不作以下操作,会出现 Could not find the main class, Program will exit. 的错误。...

    Java邮件开发Fundamentals of the JavaMail API

    The API's main purpose is not for transporting, delivering, and forwarding messages; this is the purview of applications such as sendmail and other Mail Transfer Agent (MTA) type programs. MUA-type...

    微软内部资料-SQL性能优化2

    The main advantage of running in-process is that the system usually does not need to perform a context switch. The disadvantage to running in-process is that DLL has access to the process address ...

    微软内部资料-SQL性能优化3

    If the class is not confident in their understanding, review appendix A04_Locking and its accompanying PowerPoint® file. Transactions in SQL Server provide the ACID properties: Atomicity A ...

    gertt点阵图读取器(opengl)

    MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL } } /* This Code Creates Our OpenGL Window. ...

    Bochs - The cross platform IA-32 (x86) emulator

    class, optional commit support on Bochs exit, save/restore file attributes, 1.44 MB floppy support, set file modification date/time - converted the complete hdimage stuff to the new 'hdimage' ...

    opengl画图程序附带源代码

    MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL } } /* This Code Creates Our OpenGL Window. Parameters Are: * * ...

Global site tag (gtag.js) - Google Analytics