Jvm minor version vs compiler minor version

Will the JVM throw an exception when it runs classes compiled with a JDK with the same major version but a higher version compared to the JVM?

+2


a source to share


2 answers


The JDK version doesn't really matter, the version is the format file version . Until now, a minor version of the class file format has not been used, and changes in the major version have always been consistent with the major JDK release (counting 1.2 → 1.3 → 1.4 as major releases).



In addition, the option -target

javac

can be used to create class files compatible with older versions.

+3


a source


No, the JVM will only complain if you try to run code that was compiled for a higher major version of the language. For example, you can run code compiled from JDK1.4 on 1.6 VM.



+2


a source







All Articles