[LINUX] Proxy environment support for old JDKs not supported on Ubuntu 16.04

Purpose

--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.

Implementation outline

  1. Get the list for JDK 7 from the PPA repository
  2. Get a list of installable packages
  3. Get the main body of JDK7
  4. JDK version switching

Implementation details

  1. Enter the proxy address in the environment variable

  2. Execute the following command and enter the proxy address in the environment variable.

    ```terminal
    $ export http_proxy="Proxy address"
    $ export https_proxy="Proxy address"
    ```
    
  3. Get the list for JDK 7 from the PPA repository

  4. 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 ```

  1. Get a list of installable packages

  2. Execute the following command to get a list of installable packages.

    ```terminal
    $ sudo apt-get update
    

・ ・ ・ >Reading package lists... Done ```

  1. Get the main body of JDK7

    $ sudo apt-get install openjdk-7-jdk
    
  2. Version switching

  3. 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: 
    ```
    
  4. Check the version

  5. 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

Proxy environment support for old JDKs not supported on Ubuntu 16.04
Put an old JDK that is not supported on Ubuntu 16.04 Proxy environment not supported
Build a Kubernetes environment for development on Ubuntu
Linux beginners create Ubuntu 16.04 environment on Docker (for Mac)-first half-
Build Python environment on Ubuntu (when pip is not the default)
Prepare Python development environment on Ubuntu
Building a Python environment on Ubuntu
Install confluent-kafka for Python on Ubuntu
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Environment construction of "Tello_Video" on Ubuntu
OpenCV3 & Python3 environment construction on Ubuntu
Programming environment for beginners made on Windows
Build Python3 and OpenCV environment on Ubuntu 18.04
Notes for installing Sublime Text on Ubuntu
Python virtual environment and packages on Ubuntu
[Note] Procedures for installing Ubuntu on Windows 10
Steps to install Python environment on Ubuntu
Created Ubuntu, Python, OpenCV environment on Docker
Building an environment for "Tello_Video" on Raspbian
Building an environment for "Tello_Video" on Windows
What to do if Japanese language support is not completely installed on Ubuntu 16.04