tags:

views:

157

answers:

6

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 beacause of the JRE... The i type in cmd: java -version

And it says: java version "1.3.1_01" but 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????

Please help

+6  A: 

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"

JuanZe
Thanks that worked. =)But i still don't know how when I updated java it didn't change the version automatically :S
Carlos Muñoz
It might work, but I think it's a kludge. You shouldn't need to mess with the path if your system is set up correctly.
erickson
+1  A: 

Add %JAVA_HOME%/bin to your PATH environment variable where JAVA_HOME is set to your JRE6u16 directory

Kevin
A: 

You should check your PATH environment variable. It is possible that some application you have installed has put its version of the jre in front of yours in the path.

akf
+1  A: 

You should modify your PATH environment variable:

My PC > Right click > properties > Advanced > Environment variables

And modify "Path"

Append at the end the path to your 1.6 installation:

;C:\jdk1.6.xxx\bin

and remove the previous one if present.

OscarRyz
A: 

It looks like the older Java version is still on the system PATH environment variable (where the OS looks for commands) or JAVA_HOME (where yuicompressor may look for the java executable)

How those variables are changed depends on your operating system.

Michael Borgwardt
+1  A: 

On Windows, the JRE installs a java executable in the Windows directory, which should be the first java in your path. This is just a wrapper that looks in the Windows Registry to find the Java home directory (should be "%SystemDrive%\Program Files\Java\jre6" for Java 6) and runs using the libraries there.

Run %SystemRoot%\system32\java -version and see what you get. If that is Java 6, you have entries in your path before %SystemRoot%\system32 (which really should be first). Either fix your %PATH% variable, or you'll have to be explicit whenever you want to run this version of Java.

If running that instance of java doesn't report Java 6, its not installed (correctly). Uninstall and try installing again.

If you are having trouble because of the PATH, it is because you or some software you installed monkeyed with it; I recommend using the default which is to have system32 first. Everything works fine if the defaults are used.

Also, %JAVA_HOME% is not used by the JRE itself at all. Some common Java applications like tomcat and ant honor the %JAVA_HOME% setting, so perhaps yuicompressor does too. But this is a de facto convention, not a standard.

erickson