Fork me on GitHub
could not find the main class, Program will exit(已解决)

@(报错)could not find the main class, Program will exit(已解决)  

2010-04-12 20:59:43|  分类: 电脑 |  标签:myeclipse  |字号 订阅

 
 
(报错)could not find the main class, Program will exit(已解决) - jn - Judas.n

(很抱歉,如果你希望能更加清楚地看清图片或是图上的文字的话,你可以按住ctrl不动,然后向上滚动鼠标的滚轮。要改变回来同理向下滚动即可、)

--------------------------------------------------------------------

今天2011.4.20:
这篇文章是我刚接触myeclipse的时候写的,一年过去了,感觉自己成熟了点,这篇文章还是有点不足,所以补上了。
-------------------------------------------------
一段在jcreator中能正常运行的代码,在myeclipse中
老是出现could not find the main class,program will exit。
这足可以说明代码没错,是程序的问题了。
原因和解决办法如下:
因为我们使用高版本的JDK编译的Java class文件试图在较低版本的JVM上运行,所报的错误。   因为,高版本的JDK生成的class文件使用的格式,可能与低版本的JDK的.class文件格式不同。这样,低版本的JVM无法解释执行这个.class文件,会抛出Could not find the main class.program will exit不支持的Class版本错误。 这个错误尤其在JDK5与JDK5之前的版本上表现明显。因为,JDK5在Java语法上作了不少增强,引入了一些新的.class文件的元素,导致旧版本的JVM无法解释、执行.class文件。即使这个类并没有使用任何JDK5的新元素,但是JDK5生成的.class文件,JDK1.4及其以前的JVM都无法辨认。
解决方法:
1. 弄清楚该程序是在哪个JDK版本下开发的 (JDK对于java学习者应该不能陌生)
(报错)could not find the main class, Program will exit(已解决) - Jn - Judas.n
2. 在myEclipse 菜单->Windows->Proferences->java-> Installs  Jres重新设置JDK路径,改为开发程序时的JDK版本(如上图)(我做到这一步就可以了!我的eclipse是7.0,jdk是6u13的。)
(报错)could not find the main class, Program will exit(已解决) - Jn - Judas.n
 
3. Windows->Proferences->java->Compiler,将compiler compliance level设置为与上面相同的JDK(如上图,如果你今天2011年到官方下载的JDK那可能是1.6的了,建议勾选1.6)
-----------------------------------------------------------------------------
对于项目来说,有时候出现版本问题也是跟编译级别有关系,那修改一下就可以了(如下图)
(报错)could not find the main class, Program will exit(已解决) - Jn - Judas.n
 
(报错)could not find the main class, Program will exit(已解决) - Jn - Judas.n
解决这个问题可能需要感谢它,是它给了我灵感、:
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
2011/07/21 15:30

tomcat 7.0.19 启动报错

           Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.

 日志提示是没有找到Bootstarp等这些文件,我到../tomcat/bin下,还真的没有找到这些文件,网上找了半天,也不知道原因,最后试着重新安装tomcat 7.0.19

         最后发现了问题所在,

      下载的版本有问题,

 官网上有z这几个版本,

    只要下载core 下面的 tar.gz 就可以了。

posted on 2012-02-08 14:58  HackerVirus  阅读(3746)  评论(0编辑  收藏  举报