为什么java -version返回旧版本? [英] Why does java -version return an 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.
我输入了命令:
So I think it's because of the JRE.
I typed in the command:
cmd: java -version
它说:
java version "1.3.1_01"
但是应该说 1.6.0_16
,因为我已经安装了最新版本.
But it 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屋!