For the record, as suggested on IRC, try to set JAVA_HOME and PATH:
$ update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /opt/java/64/jre1.7.0_60/bin/java 2000
auto mode
1 /opt/java/64/jre1.7.0_60/bin/java 2000
manual mode
2 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061
manual mode
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071
manual mode
$ JAVA_HOME=/opt/java/64/jre1.7.0_60
$ PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
$ JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
$ PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH java -version
java version "1.6.0_31"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
$ JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
$ PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
> _______________________________________________
On 17 July 2014 08:58, YongQin Liu <yongqin.liu@linaro.org> wrote:
> Hi, All
>
> Any method to keep java version for user separately on hackbox?
>
> Now we all use hackbox to build androids, but different android version
> needs to use
> different java version, like the master branch needs to use java7, while
> others need to
> use java6, but now seems we can only use update-alternatives to config for
> the system level,
> not for user level.
> Then where will be the problem that one changes the java version during one
> android, and causes the running build failed.
>
> Anyone has good method on resolving this problem?
>
> --
> Best Regards,
> Yongqin Liu
> ---------------------------------------------------------------
> #mailing list
> linaro-android@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-android
>
> linaro-android mailing list
> linaro-android@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-android
>
--
Fathi Boudra
Builds and Baselines Manager | Release Manager
Linaro.org | Open source software for ARM SoCs