• Register
+3 votes


I Create Loan.java and compile it with JDK 1.6

and Run Loan.class with JRE 1.5.

C:\Program Files\Java\jre1.5.0_06\bin>java -version
java version "1.5.0_06"

its shows error like bellow

C:\Program Files\Java\jre1.5.0_06\bin>java Loan
java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)

what should i do next ..

ago by (2.6k points)  

1 Answer

+2 votes


You might know that your source is compiled for higher version of JRE or Java runtime if it doesn't work in JDK 1.5 then try to run on JDK 1.6 and you will be able to remove "Bad version number in .class file"

Hope this helps you.

ago by (4.5k points)