commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [Math] How to select a specific JDK ?
Date Thu, 14 Jun 2012 01:15:02 GMT
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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message