Since all Java compiles to bytecode, why would you ever get an UnsupportedClassVersionError?

100 Views Asked by At

I know that UnsupportedClassVersionError happens when trying to run code compiled with newer versions of the JDK, such as Java 1.7 on a Java 1.6 JDK.

I don't understand why this would happen. The compiled code is bytecode and, as I understand bytecode, it is a very simple and minimal version of the code.

For example Java's 8 lambdas are just methods in the byte code, since methods are supported from JDK 1.0 there should not be a problem running code compiled in JDK 8 on JDK 1.

What changes to later Java versions would preclude a Java class compiled with a newer JDK from running on an older JDK?

Thanks!

0

There are 0 best solutions below