Will JVM throw exception when it runs classes compiled with a JDK that has same major version but higher minor version compared to JVM ?
+1
A:
No, the JVM will only complain if you try to run code that has been compiled for a higher major version of the language. For example you can run code compiled with JDK1.4 on a 1.6 VM.
M. Jessup
2010-04-23 14:53:20
+1
A:
The JDK version does not really matter, the class file format version does. So far, the minor version of the class file format hasn't been used, and changes in the major version have always corresponded with major JDK release (counting 1.2 -> 1.3 -> 1.4 as major releases).
Additionally, the -target
option of javac
can be used to produce class files compatible with older runtimes.
Michael Borgwardt
2010-04-23 14:54:08
Thanks Michael. It is the class file format version.I tried to look for authoritative reference from Sun which would list what JDK results in what class version. I could only find this information from various blogs.major minor Java platform version 45 3 1.045 3 1.146 0 1.247 0 1.348 0 1.449 0 1.550 0 1.6
tech20nn
2010-04-23 15:22:05