3 ms·
You can get Java 6 bytecode from a Java 8 compiler but it will fail to compile if you used Java 8 features: $ jdk-1.8-64/bin/javac -target 1.6 -source 1.6
by acveilleux 11y ago
You can get Java 6 bytecode from a Java 8 compiler but it will fail to compile if you used Java 8 features:
$ jdk-1.8-64/bin/javac -target 1.6 -source 1.6 LambdaTest.java
warning: [options] bootstrap class path not set in conjunction with -source 1.6
LambdaTest.java:16: error: lambda expressions are not supported in -source 1.6
Runnable r2 = () -> System.out.println("Hello world two!");
^
(use -source 8 or higher to enable lambda expressions)
1 error
1 warning
Trying to heed the error:
$ jdk-1.8-64/bin/javac -target 1.6 -source 8 LambdaTest.java
javac: source release 8 requires target release 1.8