$ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
Here, when the version is displayed for "1.6.0_xx", change it to use JDK 7. This switching is done with the update-alternatives command.
$ sudo update-alternatives --config java
alternative java (provides /usr/bin/java) has 2 choices.
Option path priority status
-------------------------------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
Press Enter to keep the current selection [*], otherwise press the key of the choice: 2
Since JDK 7 is used, specify the number "2". After this operation, check the JDK with java -version.
$ java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
If you also have OpenJDK installed, you can check the selection status below.
$ update-alternatives --config java
alternative java (provides /usr/bin/java) has 2 choices.
Option path priority status
-------------------------------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode
Press Enter to keep the current selection [*], otherwise press the key of the choice:
Debian 7.0 Wheezy
OpenJDK7
For the procedure, refer to Ubuntu 14.04 above. It can be set by the same procedure.
oracleJDK7 (Method using java-package: corresponding from Debian 7.0)
$ make-jpkg jdk-7u75-linux-x64.tar.gz
$ ls
oracle-j2sdk1.7_1.7.0+update75_amd64.deb
# dpkg -i oracle-j2sdk1.7_1.7.0+update75_amd64.deb
Select oracleJDK.
# update-alternatives --config java
alternative java (provides /usr/bin/java) has 3 choices.
Alternative java (provides /usr/bin/java) has 3 choices.
Option path priority status
-------------------------------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java 317 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 1051 manual mode
Press Enter to keep the current selection [*], otherwise press the number of the choice: 1
Confirmation of JDK
$ java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
Debian 6.0 Squeeze
OpenJDK7
Add the wheezy repository to the end of /etc/apt/sources.list.
# vi /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian/ wheezy main
Since it was added only for the installation of openjdk 7, the priority is the sqeeze version, so create a local file in / etc / apt / apt.conf.d and write the following.
# vi /etc/apt/apt.conf.d/local
APT::Default-Release "squeeze";
On the other hand, the priority of the package included in wheezy is kept to a minimum. In the squeeze environment, we want to avoid having to upgrade major libraries unnecessarily.
Create a wheezy file in /etc/apt/preferences.d and write the following.
# vi /etc/apt/preferences.d/wheezy
Package: *
Pin: release n=wheezy
Pin-Priority: 10
For priority, 100 is allocated to the package being installed, 500 is allocated to the package not installed, so specify a value smaller than 100.
# update-alternatives --config java
alternative java (provides /usr/bin/java) has 3 choices.
Option path priority status
-------------------------------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.7 1047 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
Press Enter to keep the current selection [*], otherwise press the number of the choice: 3
Confirmation of JDK
# java -version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.7) (7u3-2.1.7-1)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
# update-alternatives --config java
There are four choices in alternative java (providing /usr/bin/java).
Option path priority status
-------------------------------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.7 1047 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
* 3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
4 /usr/lib/jvm/jdk1.7.0-oracle/bin/java 1 manual mode
Press Enter to hold the current selection [*], otherwise press the number of the choice: 4
Confirmation of JDK
$ java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
Register oracleJDK to alternatives. At this time, if you use the /usr/java/latest path from the installation above, you can see that it does not depend on the JDK version number.
Before registering, check the Java settings.
The above result shows that orbd is registered as a slave. When invoking the name server, the path must be passed to orbd. The slave specifies what you want to switch with java installed with update-alternatives - install. Therefore, when registering oracleJDK to alternatives, we also specify with --slave option.
Also, the priority item 170075 is priority. update-alternatives --install Specify the priority when running. Since the version of OpenJDK 7 and orcleJDK 7 is the same this time, we will specify 170075 as the priority when registering oracleJDK 7.
For these reasons, register with the following settings.
# update-alternatives --config java
There are 2 programs and provide 'java'.
Selection command
-----------------------------------------------
*+ 1 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64/jre/bin/java
2 /usr/java/latest/bin/java
Press Enter to hold the current selection [+] or enter the selection number: 2
Confirmation of JDK
# java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
JDK installation hints
The JDK installs either OpenJDK or OracleJDK. Here, we will show you how to install in the following environment.Ubuntu 14.04
OpenJDK7
It can be installed with apt-get.
Confirmation of JDK
Here, when the version is displayed for "1.6.0_xx", change it to use JDK 7. This switching is done with the update-alternatives command.
oracleJDK7
Add the repository and install oracleJDK7.
Confirmation of JDK
If you also have OpenJDK installed, you can check the selection status below.
Debian 7.0 Wheezy
OpenJDK7
For the procedure, refer to Ubuntu 14.04 above. It can be set by the same procedure.
oracleJDK7 (Method using java-package: corresponding from Debian 7.0)
Follow the instructions on the right to install. https://wiki.debian.org/JavaPackage
Add the following sentence to the end of /etc/apt/sources.list.
Install the required java-package to install the JDK.
Download the JDK (here jdk-7u75-linux-x64.tar.gz) from the oracle site.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Generate and install the deb package.
Select oracleJDK.
Confirmation of JDK
Debian 6.0 Squeeze
OpenJDK7
Add the wheezy repository to the end of /etc/apt/sources.list.
Since it was added only for the installation of openjdk 7, the priority is the sqeeze version, so create a local file in / etc / apt / apt.conf.d and write the following.
On the other hand, the priority of the package included in wheezy is kept to a minimum. In the squeeze environment, we want to avoid having to upgrade major libraries unnecessarily.
Create a wheezy file in /etc/apt/preferences.d and write the following.
For priority, 100 is allocated to the package being installed, 500 is allocated to the package not installed, so specify a value smaller than 100.
Select OpenJDK 7.
Confirmation of JDK
oracleJDK 7 (How to install with update-alternatives)
Debian 6.0 does not support java-package, so install it with update-alternatives.
Download the JDK (here jdk-7u75-linux-x64.tar.gz) from the oracle site.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Unzip it and move the generated directory jdk1.7.0_75 to /usr/lib.
Install with the update-alternatives command. At this time, the priority is specified, but here it is 1.
Select oracleJDK.
Confirmation of JDK
Reference site (external site):
Fedora 20
OpenJDK7
It is already installed.
oracleJDK7
Download the JDK (jdk-7u75-linux-x64.rpm in this case) from the oracle site.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Installation
Confirm installation destination
Register oracleJDK to alternatives. At this time, if you use the /usr/java/latest path from the installation above, you can see that it does not depend on the JDK version number.
Before registering, check the Java settings.
The above result shows that orbd is registered as a slave. When invoking the name server, the path must be passed to orbd. The slave specifies what you want to switch with java installed with update-alternatives - install. Therefore, when registering oracleJDK to alternatives, we also specify with --slave option.
Also, the priority item 170075 is priority. update-alternatives --install Specify the priority when running. Since the version of OpenJDK 7 and orcleJDK 7 is the same this time, we will specify 170075 as the priority when registering oracleJDK 7.
For these reasons, register with the following settings.
Select oracleJDK.
Confirmation of JDK