could not find the main class : program will exit
2012-09-23 09:06
477 查看
今天在部署项目时不小心把tomcat6和tomcat7搞混了,在启动tomcat时报了could not find main class,在网上搜了一下,发现是tomcat版本问题,这是因为我们使用高版本的JDK编译的Java class文件试图在较低版本的JVM上运行,所报的错误。 因为,高版本的JDK生成的class文件使用的格式,可能与低版本的JDK的.class文件格式不同。这样,低版本的JVM无法解释执行这个.class文件,会抛出Could not find the
main class.program will exit。
这个错误尤其在JDK5与JDK5之前的版本上表现明显。因为,JDK5在Java语法上作了不少增强,引入了一些新的.class文件的元素,导致旧版本的JVM无法解释、执行.class文件。即使这个类并没有使用任何JDK5的新元素,但是JDK5生成的.class文件,JDK1.4及其以前的JVM都无法辨认!
只要在window->preferences->java->complier下的jdk的版本改成与我们使用的一致就o了。
main class.program will exit。
这个错误尤其在JDK5与JDK5之前的版本上表现明显。因为,JDK5在Java语法上作了不少增强,引入了一些新的.class文件的元素,导致旧版本的JVM无法解释、执行.class文件。即使这个类并没有使用任何JDK5的新元素,但是JDK5生成的.class文件,JDK1.4及其以前的JVM都无法辨认!
只要在window->preferences->java->complier下的jdk的版本改成与我们使用的一致就o了。
相关文章推荐
- @(报错)could not find the main class, Program will exit(已解决)
- Could not find the main class. Program will exit
- MyEclipse导入项目错误:Could not find the main class.Program will exit.
- Could not find the main class: org.apache.catalina.startup.Boostrap. Program will exit.
- Debian配置JAVA环境报错之Could not find the main class: HelloWorld. Program will exit.
- Java中Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 的解决方法
- Eclipse运行异常: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
- Eclipse 运行项目抛UnsupportedClassVersionError弹出yunCould 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和java.lang.UnsupportedClassVersionError 错误的解决办法
- Could not find the main class: org.apache.catalina.startup.Boostrap. Program will exit
- 安装java的时候出现Could not find the main class.program will exit
- Could not find the main class: org.apache.catalina.startup.Boostrap. 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
- Could not find the main class.Program will exit.