--Ubundle 16.04 currently supports both JDK 8 and JDK 9, but here's a summary of how to put an older version of the JDK under a proxy environment. --This time, we will introduce JDK7 as an example.
Enter the proxy address in the environment variable
Execute the following command and enter the proxy address in the environment variable.
```terminal
$ export http_proxy="Proxy address"
$ export https_proxy="Proxy address"
```
Get the list for JDK 7 from the PPA repository
Execute the following command to get the list to install JDK7. (By adding the option -E
, it is possible to execute using the value stored in the environment variable.)
```terminal
$ sudo -E add-apt-repository ppa:openjdk-r/ppa
・ ・ ・ >Reading package lists... Done ```
Get a list of installable packages
Execute the following command to get a list of installable packages.
```terminal
$ sudo apt-get update
・ ・ ・ >Reading package lists... Done ```
Get the main body of JDK7
$ sudo apt-get install openjdk-7-jdk
Version switching
If you have multiple JDK versions installed, switch the JDK version (if you see the output below, enter the number at the beginning of the line for the version of the JDK you want to change and enter, this time Enter 1 because you want to use JDK7 Enter)
```terminal
$ sudo 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-8-openjdk-amd64/jre/bin/java 1081 auto mode
>1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
>2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
>Press <enter> to keep the current choice[*], or type selection number:
```
Check the version
Execute the following command to check the JDK version. (OK if it looks like the following)
```terminal
$ java -version
>java version "1.7.0_95"
>OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3)
>OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
```
Recommended Posts