Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does java -version return an old version?

Tags:

java

OS: Windows XP

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)

So I think it's because of the JRE.
I typed in the command:

cmd: java -version

And it says:

java version "1.3.1_01"

But it should say 1.6.0_16, since I have installed the latest version.

What should I do to make Java use the latest version instead of the old one?

like image 803
Carlos Muñoz Avatar asked Oct 14 '09 15:10

Carlos Muñoz


People also ask

Does Java return by reference or copy?

It just returns THE reference.

What is the point of returning in Java?

A return statement causes the program control to transfer back to the caller of a method. Every method in Java is declared with a return type and it is mandatory for all java methods. A return type may be a primitive type like int, float, double, a reference type or void type(returns nothing).

What does return 1 do in Java?

Your method has no return type, Provide a return type of int in your method. And return -1 means nothing in java, you are just returning a int value, thats it.

Why Java is always pass by value?

Object references are passed by value The reason is that Java object variables are simply references that point to real objects in the memory heap. Therefore, even though Java passes parameters to methods by value, if the variable points to an object reference, the real object will also be changed.


1 Answers

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"

like image 55
JuanZe Avatar answered Oct 21 '22 12:10

JuanZe