• Register
1 vote
20 views

Problem:

I Created a 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"

The following thing gives an error message:

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 ..

 

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

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

Happy coding.

11 6 4
34,950 points

Related questions

2 votes
1 answer 24 views
24 views
Problem: 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 ... Unknown Source)         at java.net.URLClassLoader.defineClass(Unknown Source)         at java.net.URLClassLoader.access$100(Unknown Source) what should i do next ..
asked Mar 24, 2020 LizzyM 6.1k points
0 votes
1 answer 48 views
48 views
Hi, when i try to execute this code i always get the error message from above, and i really want to know why, already tried to put a “public class XXXX” before the code, but not work anyway. public static String invertirPalabras(String cadena) { cadena += " "; String ... + palabra; if (cadena.charAt(i) == ' ') { nuevaCadena += palabra; palabra = ""; } } return nuevaCadena.trim(); }
asked Aug 2, 2020 Daniel Aguilar
3 votes
1 answer 2K views
2K views
Problem: Hello Kodlogs, I am a novice Java programmer. I just wrote my very first program a few minutes earlier. Now I want to write a program that can add two different integer numbers for me. I guess I done my coding well but it says something wrong with my writing and throws back an error: &ldquo ... []args){ int x = 10; int y = 15; int sum = x+y; System.out.println("Sum is: " + sum); } }
asked Mar 23, 2020 Gavin 15.3k points
0 votes
1 answer 30 views
30 views
Therefore, I have to conclude something else, internal to a class itself, is throwing the exception?? Is that even possible?
asked Jan 4 TeamScript 13.5k points
0 votes
1 answer 83 views
83 views
Problem : I am getting this error when I include an opensource library that I had to compile from source. java lang unsupportedclassversionerror bad version number in class file
asked Oct 23, 2019 peterlaw 6.9k points
1 vote
1 answer 53 views
53 views
Problem: I am totally new in programming language. So I tried to write a program using: public static void main(String args[]) But it seems to give error : public static void main(String args[]) ^ IndentationError: unexpected indent What should I do?
asked Apr 2, 2020 LizzyM 6.1k points
0 votes
1 answer 421 views
421 views
Problem : I am getting bellow error while I'm trying to use visual studio code for Java. this version of the java runtime only recognizes class file versions up to 52.0
asked Oct 19, 2019 peterlaw 6.9k points
0 votes
1 answer 23 views
1 vote
1 answer 33 views
33 views
Problem : I am new in java and I am getting the following error after importing a project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files However, I have set the path as C:\Program Files\Java\jdk1.6 ... Kepler, through Window » Preferences » Java » Installed JREs. Any ideas on what I need to do to fix this? Thanks!
asked Apr 9 Sabbir Hossain 14.6k points