为什么java -version会返回旧版本? [英] Why does java -version returns old version?
问题描述
操作系统:Windows XP
OS: Windows XP
我使用yuicompressor-2.4.2压缩一些CSS,然后再上传到我的服务器。
但是当我运行它时,会出现以下异常:
I am using yuicompressor-2.4.2 to compress some CSS before uploading to my server. But when I run it, the following exception appears:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
com/yahoo/platform/yui/compressor/Bootstrap (Unsupported major.minor version 48.0)
所以我认为这是因为JRE。我在cmd中键入的命令:java -version
So I think it's because of the JRE. The command I typed in cmd: java -version
它说:java版本1.3.1_01但应该说1.6.0_16因为我已经安装了最新版本版本。
And it says: java version "1.3.1_01" but should say "1.6.0_16" since I have installed the latest version.
如何让Java使用最新版本而不是旧版本?
What should I do to make Java use the latest version instead of the old one?
推荐答案
设置环境变量JAVA_HOME指向你有jdk的目录1.6.0
Set the environment variable JAVA_HOME pointing to the directory where you have jdk 1.6.0
set JAVA_HOME=your_path_to_jdk1.6
set PATH=%JAVA_HOME%/bin;.;..;%PATH%
这是来自命令窗口。您也可以从我的电脑>属性>高级>环境变量
That's from a command window. Also you can do it from "My PC > Properties > Advanced > Environment variables"
这篇关于为什么java -version会返回旧版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!