Search code examples
javajarexecutable-jar

Between Runtime and compile time jdk version , which one can be greater


Which one of the two, runtime version and compile time version of a java program or a jar, should be greater or equal to the other? Edit : Also what should be the version of JRE System Library?


Solution

    • So, my understanding is that you are compiling a java application with jdk1.6 and running the same application on a runtime which is based on jdk1.8. (for example, it could jdk1.7 too here)
    • Generally, JDK/JRE would be designed in such a way that it is backwards-compatible.
    • It would be better to use a runtime environment version (JVM) that is greater than or equal to the compile version and not vice-versa.
    • JDK(Compile-Version) <= JDK(Runtime-Version) - Correct
    • JDK (Compile-Version) >= JDK(Runtime -Version) - Incorrect