Java执行main方法,异常为:could not find the main class.program will exit

Java执行方法,异常为:could not find the main class.program will exitmain


原因和解决办法如下: 
出现这个错误是由于你的jdk版本与eclipse高版本配置造成的. 
因为我们使用高版本的JDK编译的Java class文件试图在较低版本的JVM上运行,所报的错误。   因为,高版本的JDK生成的class文件使用的格式,可能与低版本的JDK的.class文件格式不同。这样,低版本的JVM无法解释执行这个.class文件,会抛出Could not find the main class.program will exit不支持的Class版本错误。 




解决方法: 
1. 弄清楚该程序是在哪个JDK版本下开发的 
2. 在myEclipse 菜单->Windows->Proferences->java-> Installs  Jres重新设置JDK路径,改为开发程序时的JDK版本(我做到这一步就可以了!我的eclipse是7.0,jdk是6u13的。) 

3. Windows->Proferences->java->Compiler,将compiler compliance level设置为与上面相同的JDK


原文地址:http://rogerfederer.iteye.com/blog/737377

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值