Can we use jdk7 javac to compile code with java7 functions in java6 bytecode

I considered the question of whether a java project can create 2 jars: one for java7 and one for java6, yes, the source code can use some some new functions of java7.

so to generate java6 jar command line will look like this:

javac -target 1.6 -bootclasspath jdk1.6.0\lib\rt.jar -extdirs "" MyApp.java

Unfortunately, He just emits an error:

javac: target release 1.6 conflicts with default source release 1.7

According to this document , it should be possible for jdk6 vs jdk5, does anyone know why it does not work in jdk7 vs jdk6? Am I doing something wrong or is it officially not officially supported?

Thank.

+5
source share
2 answers

AFAIK, . Java 6. 1.1 target 1.0.

JVM JVM Java 6 Java 7, . Java 6 , End Of () 2012 , ...

+5

, - , java 6, java 6. java , , java 7 6- -, , 7- .

+2

All Articles