Eclipse运行异常:Could not find the main class.
来源:互联网 发布:samba访问windows共享 编辑:程序博客网 时间:2024/05/23 20:04
Eclipse 出现 could not find the main class, 多半是由于使用的JDK版本不当引起的。
异常原因:使用Eclipse工具新建一个名为MyProj的java工程,并在其中创建一个简单的java类进行运行测试时,Eclipse抛出名为“Could not find the main class.Program will exit.”的异常。
核查原因:本机上存在多个JDK版本(即:1.4和1.5两个版本),由于MyProj的默认JDK版本与Eclipse工具使用的JDK版本不一致,所以产生如上异常。
解决办法:使MyProj默认的JDK版本与Eclipse工具使用的JDK版本保持一致即可。具体处理方式如下。
1、首先核查Eclipse使用的JDK版本。Window --> Preferences --> Java --> Installed JREs。在右侧的Installed JREs窗口中查看当前使用的JDK版本(本机设置的是JDK1.4)。
2、鼠标点击MyProj工程,使鼠标聚焦在该工程上,然后点击菜单栏Project --> Properties --> Java Compiler。在其右侧的JDK Compliance中,查看Compiler compliance level中的JDK版本是否与上面查看的JDK版本一致,若不一致,使其保持一致即可(本机中该工程默认的版本为5.0,将其版本号修改为1.4即可)。
注:若该栏为死灰色无法编辑,请点击上面的名为Enable project specific settings复选框即可进行JDK版本的修改
eclipse下有几个需要使用jre的地方。第一个是编译器使用,第二个是开发使用,第三个是运行时使用。遗憾的是这三个是需要分别配置的,你的问题就在于eclipse的这三个包之间有版本冲突!你可以上网查一下eclipse的jre配置过程。尽量将eclipse自带的jre更换为官方的,而且版本最好一致!
- Eclipse运行异常:Could not find the main class.
- Eclipse运行异常:Could not find the main class. Program will exit.
- Eclipse could not find the main class
- [Eclipse] Could not find the main class. Program will exit
- Could not find the main class:
- Could not find the main class
- eclipse执行编译后的类文件抛出Could not find the main class: 异常解决方案之一
- Java执行main方法,异常为:could not find the main class.program will exit
- Myeclips运行的的时候出现Could not find the main class:Main. Program will exit.
- java程序运行时出现问题:Could not find the main class: test_jena. Program will exit.
- 运行jar文件时,出现“could not find the main class”的解决方法
- 解决运行java application时提示Could not find the main class.Program will exit.问题
- dos运行java类时遇到Could not find the main class问题
- Could not find main class
- Could not find main class
- Eclipse中执行Ant脚本出现Could not find the main class的问题及解
- Eclipse 出错:Could not find the main class. Program will exit
- Eclipse中执行HelloWorld出现Could not find the main class
- POJ3026《Borg Maze》方法:bfs+prim 居然WA
- NSDate详解
- typedef int int_array[4]
- js函数(比较全)
- [ASP.NET学习笔记之一]ASP.NET中文件操作
- Eclipse运行异常:Could not find the main class.
- 10887 - Concatenation of Languages
- C++的const类成员函数
- VMWARE虚拟机连接主机,或被其他网内的机器访问的问题
- Google 地图 API V3 使用入门1
- 相对路径、绝对路径、根路径
- vim 零零散散
- 方向
- android退出程序销毁多个Activity方法