Java 9 come with very nice feature to compile java file in older version of java. Up to java 8 JDK, If we install Only JDK 8 install in our system than we can only compile our code in JDK 8, To compile our code in JDK 7 using JDK 8 was not possible but in Java 9 its possible to compile our code in JDK 6, JDK 7, JDK 8, JDK 9.
Java defined a new command-line option,
--release, which automatically configures the compiler to produce class files that will link against an implementation of the given platform version.
javac –release 8 Java8Demo.java