被环境变量折腾到不行了
不好意思,我搜到很多人都问过环境变量的问题,但是所有方法都试了还是不行……
我的系统是xp的,环境变量如下:
classpath=.;F:\Program Files\Java\jdk1.6.0\lib\dt.jar;F:\Program Files\Java\jdk1
.6.0\lib\rt.jar;F:\Program Files\Java\jdk1.6.0\lib\tools.jar;F:\Program Files\Ja
va\jdk1.6.0\bin
Path=.;F:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program File
s\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;F
:\Program Files\Java\jdk1.6.0\bin;F:\Program Files\Java\jdk1.6.0\jre\bin;F:\Prog
ram Files\Microsoft Visual Studio\Common\Tools\WinNT;F:\Program Files\Microsoft
Visual Studio\Common\MSDev98\Bin;F:\Program Files\Microsoft Visual Studio\Common
\Tools;F:\Program Files\Microsoft Visual Studio\VC98\bin
程序代码Test.java如下:
public class Test{
public static void main (String[] args){
System.out.println( "This is a test program. ");
}
}
放在桌面上,在桌面执行javac Test.java可以编译成功
再执行java Test就报错:
Exception in thread "main "
java.lang.UnsupportedClassVersionError: Test (Unsuppo
rted major.minor version 50.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)
请帮我,谢谢!
------解决方案--------------------这个是很难搞的,呵呵。。。。
Path=.;F:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program File
s\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;F
:\Program Files\Java\jdk1.6.0\bin;F:\Program Files\Java\jdk1.6.0\jre\bin;F:\Prog
ram Files\Microsoft Visual Studio\Common\Tools\WinNT;F:\Program Files\Microsoft
Visual Studio\Common\MSDev98\Bin;F:\Program Files\Microsoft Visual Studio\Common
\Tools;F:\Program Files\Microsoft Visual Studio\VC98\bin
改为这个(jdk1.6移到前面去了。)
Path=.;F:\Program Files\Java\jdk1.6.0\jre\bin;F:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program File
s\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;F
:\Program Files\Java\jdk1.6.0\bin;F:\Prog