Eclipse 运行项目抛UnsupportedClassVersionError弹出yunCould not find the main class.program will exit
2013-07-07 09:28
651 查看
出现Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 错误的原因,是因为我们使用高版本的JDK编译的Java class文件试图在较低版本的JVM上运行,所报的错误。
因为,高版本的JDK生成的class文件使用的格式,可能与低版本的JDK的.class文件格式不同。这样,低版本的JVM无法解释执行这个.class文件,会抛出Could not find the main class.program will exit,java.lang.UnsupportedClassVersionError不支持的Class版本错误。
eclipse下有几个需要使用jre的地方。第一个是编译器使用,第二个是开发使用,第三个是运行时使用。
遗憾的是这三个是需要分别配置的,你的问题就在于eclipse的这三个包之间有版本冲突!
Windows->Proferences->java-> Installs Jres重新设置JDK路径
Windows->Proferences->java->Compiler,将compiler compliance level设置为与上面相同的JDK
这样试了一下还是不行,发现对于项目来说,compiler compliance level也有不同,
Windows->Proferences->java->Compiler->config project specific settings
因为,高版本的JDK生成的class文件使用的格式,可能与低版本的JDK的.class文件格式不同。这样,低版本的JVM无法解释执行这个.class文件,会抛出Could not find the main class.program will exit,java.lang.UnsupportedClassVersionError不支持的Class版本错误。
eclipse下有几个需要使用jre的地方。第一个是编译器使用,第二个是开发使用,第三个是运行时使用。
遗憾的是这三个是需要分别配置的,你的问题就在于eclipse的这三个包之间有版本冲突!
Windows->Proferences->java-> Installs Jres重新设置JDK路径
Windows->Proferences->java->Compiler,将compiler compliance level设置为与上面相同的JDK
这样试了一下还是不行,发现对于项目来说,compiler compliance level也有不同,
Windows->Proferences->java->Compiler->config project specific settings
相关文章推荐
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法 .
- Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 错误的解决办法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法 .
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Eclipse运行异常:Could not find the main class. Program will exit.
- Eclipse 出错:Could not find the main class. Program will exit
- JAVAEclipse:could not find the main class,program will exit!
- 解决运行java application时提示Could not find the main class.Program will exit.问题
- MyEclipse导入项目错误:Could not find the main class.Program will exit.
- java程序运行时出现问题:Could not find the main class: test_jena. Program will exit.
- Myeclips运行的的时候出现Could not find the main class:Main. Program will exit.
- [Eclipse] Could not find the main class. Program will exit
- 解决java virtual machine launcher 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