It’s possible to have more than one version of Java in the same machine.
If you have more than one Java JRE or JDK installed you can switch between them with the update-alternatives
command:
$ sudo /usr/sbin/update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 auto mode 1 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 manual mode 2 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java to provide /usr/bin/java (java) in manual mode.
You can do just the same for javac:
$ sudo /usr/sbin/update-alternatives --config javac There are 2 choices for the alternative javac (providing /usr/bin/javac). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-6-openjdk-i386/bin/javac 1061 auto mode 1 /usr/lib/jvm/java-6-openjdk-i386/bin/javac 1061 manual mode 2 /usr/lib/jvm/java-7-openjdk-i386/bin/javac 1051 manual mode Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/javac to provide /usr/bin/javac (javac) in manual mode.
You can check wich version is currently in use running:
$ java -version java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK Server VM (build 23.7-b01, mixed mode) $ javac -version javac 1.7.0_25