By W.ZH Jan 2010Issue: 

I am testing a fx ui program from netbean, all compile OK, but I get this error when I try to run it.

java.lang.UnsupportedClassVersionError: Bad version number in .class file

at java.lang.ClassLoader.defineClass1(Native Method)


After google, I found reason is because java version issue. such as , your compile java is different version with the runtime java. I check my netbean’s tools- javaplatform , the compiler use C:\Program Files\Java\jdk1.6.0_16.    But when I go the windows console, “java -version” shows –  java version “1.5.0_22”. I know this is the reason.

Several days before i install the JRE 5 fro my IE as one of applet need it. so the windows use the 1.5 as the default version,

but when I check Set in the console env, I found it JAVA_HOME set to 1.6 version, So what the reason to control the windows command console’s java?


HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jarfile\shell\open\command  afer u open this reg , u will know how to solve this issue.