Hello.

> > [...]

The following:

> >> > I should be able to do all combinations, i.e.:
> >> >  1. Compile with javac 1.6 and run with java 1.6
> >> >  2. Compile with javac 1.7 and run with java 1.7

is achieved by those respective commands:

 $ JAVA_1_6_HOME=/usr/lib/jvm/java-6-sun mvn -X -Pjava-1.6 clean test
 $ JAVA_1_7_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn -X -Pjava-1.7 clean test

IIUC:
  JAVA_x_y_HOME is used to locate the "javac" executable
  -Pjava-x.y selects the language level
  JAVA_HOME has no effect

This, however,

> >> >  3. Compile with javac 1.6 and run with java 1.7

is not so easy.  To run the tests with 1.7, one needs

 $ JAVA_1_6_HOME=/usr/lib/jvm/java-6-sun mvn 
-Dcommons.surefire.java=/usr/lib/jvm/java-7-openjdk-amd64/bin/java -X 
-Pjava-1.6 clean test

> > [...]

Much to my surprise, this

 $ JAVA_1_7_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn 
-Dcommons.surefire.java=/usr/lib/jvm/java-6-sun/bin/java -X -Pjava-1.7 clean 
test

(i.e. using java 1.6 to run classes compiled with javac 1.7) also works! Is
that expected? [I thought I'd get the "incompatible major.minor version"
exception.]


Best regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to