Could not find the main class.Program will exit.
2011-03-11 10:20
357 查看
问题描述:
将一个工程导入eclipse后,运行时报错“Could not find the main class.Program will exit.”
原因分析:
我原先编译这个工程是使用的jdk1.6,后来由于某些原因换成了jdk1.5,结果出现了上面的问题。应该是因为重新导入工程后用低版本的jvm运行高版本jdk编译的文件。
解决方法:
工程名处右键-->选择“Properties”-->点击“Java Compiler”-->将右侧框中的“Compiler compliance level”以及它下面的设置都改为1.5(其实应该改为编译原工程时使用的jdk版本)。
注:
如果这样设置之后出现小红叉,则应该看看是不是因为版本差别,程序中使用了jdk中没有的函数(可能你使用的函数是高版本jdk中新加的);或者看看是不是语法上的差别的,例如@Override问题。
将一个工程导入eclipse后,运行时报错“Could not find the main class.Program will exit.”
原因分析:
我原先编译这个工程是使用的jdk1.6,后来由于某些原因换成了jdk1.5,结果出现了上面的问题。应该是因为重新导入工程后用低版本的jvm运行高版本jdk编译的文件。
解决方法:
工程名处右键-->选择“Properties”-->点击“Java Compiler”-->将右侧框中的“Compiler compliance level”以及它下面的设置都改为1.5(其实应该改为编译原工程时使用的jdk版本)。
注:
如果这样设置之后出现小红叉,则应该看看是不是因为版本差别,程序中使用了jdk中没有的函数(可能你使用的函数是高版本jdk中新加的);或者看看是不是语法上的差别的,例如@Override问题。
相关文章推荐
- could not find the main class, Program will exit(已解决)
- jdk版本不同造成问题解决could not find the main class, Program will exit(2)
- Could not find the main class ***.Program will exit
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法 .
- Myeclips运行的的时候出现Could not find the main class:Main. Program will exit.
- could not find the main class, Program will exit(已解决)
- 错误处理:could not find the main class, Program will exit
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- runnable jar 不能在win7打开,显示错误:Could not find the main class. Program will exit.
- 转:could not find the main class, Program will exit (说明编译器compiler版本要不高于installed JREs,JVM版本)
- Could not find the main class: org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
- <综合>java virtual machine launcher 提示 could not find the main class,program will exit 问题
- JAVAEclipse:could not find the main class,program will exit!
- Could not find the main class. Program will exit
- 错误处理:could not find the main class, Program will exit
- could not find the main class. program will exit问题的解决方法
- junit:could not find the main class Program will exit
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- 【解决方法】Could not find the main class Program will exit
- Could not find the main class program will exit的终极解决办法,神坑