Will JVM throw exception when it runs classes compiled with a JDK that has same major version but higher minor version compa开发者_如何学JAVAred to JVM ?
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.
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.
精彩评论