1.现象:
package com.jeff.hello;
public class Test {
public static void main(String [] args){
System.out.print("hello world");
}
}
这样一个类,总是编译报一下错误
java.lang.UnsupportedClassVersionError: com/jeff/hello/Test (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"
奇怪了,现在用到的是eclipse3.2,而原来的eclipse里文件是3.0过来的
2.解决,试了将jre1.4改成1.5,ok
具体:点项目名右键/Properties/Libraries/里,将原来的jre1.4的去掉,然后 点 Add Library / JRE System Library /
Alternate JRE---Installed JREs / add /填上1.5 jre的路径
再编译,ok了