【解决方法】Could not find the main class Program will exit
来源:互联网 发布:淘宝买主板 编辑:程序博客网 时间:2024/06/10 06:12
问题背景:
从别人那考的程序,工程上出现红叹号,于是修改了一下Java Build Path中的jdk版本(原来是1.5的,我没有1.5,就给改成1.6了)。
开发环境:
eclipse + jdk1.6 + jdk1.7(我装了两个jdk)
错误原因:
可能是在打开方式中的javaw版本过低。比如jdk1.5编译的class文件用1.4的javaw打开就会出现这个问题。
对于我来讲,工作目录默认的jdk是1.7的,即Java Compiler是1.7,所以编译的class应该是用的1.7。而打开的时候则是用的1.6的,所以会出现上面所说的错误。(错就错在我装了两个jdk)
解决方法:
知道了错误原因解决就方便了,将Java Build Path中的jdk和Java Compiler中的jdk版本指定成同一个即可。
具体位置如下图:
PS:网上对于这个错误的讨论有很多,但由于本人比较笨,没找到我这种情况的解决方法。所以,如果你的问题和我的不同,可以继续Google一下,有很多种问题和解决方法。
本文的“错误原因”条目参考自:http://www.myexception.cn/j2se/175408.html
- 【解决方法】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...
- 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.
- junit:could not find the main class Program will exit
- [Eclipse] 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
- 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.
- Could not find the main class. Program will exit
- could not find the main class : program will exit解决方案
- Oracle用户和模式的区别
- 提交表单的时候,后台走了两遍
- 通向架构师的道路(第二十天)万能框架spring(二)maven结合spring与ibatis
- 编辑框根据显示数据自动垂直滚动到底端的方法
- 通向架构师的道路(第二十一天)万能框架spring(三)之SSH
- 【解决方法】Could not find the main class Program will exit
- 南阳理工OJ_5个数求最值
- 多吃防晒食物 肌肤白皙年轻
- 论文自动生成目录的方法
- log4j.properties和log4j.xml配置
- ORACLE 基本命令、表空间创建
- 【迭代器】自己写一个集合实现Iterable迭代功能
- 通向架构师的道路(第二十二天)万能框架spring(四)使用struts2
- Android中图片占用内存的计算