Search code examples
javacompilationbackwards-compatibilityjava-6java-7

Wondering whether I need to installll JDK 1.6 & 1.7 together?


Can I use JDK 1.7 to compile the code written in JDK 1.6? Is Java strict downward compatible?

Do I need to keep JDK 1.6 and JDK 1.7 together in the same machine?


Solution

  • Can I use JDK 1.7 to compile the code written in JDK 1.6?

    Yes.

    Is Java strict downward compatible?

    If the cross-compilation options are specified when compiling. Those are most notably:

    • -source
    • -target
    • -bootclasspath - which requires an rt.jar of the JRE (not JDK) being targeted