Rate This Document
Findability
Accuracy
Completeness
Readability

Installing OpenJDK

To use the Java development and runtime environment, you need to install OpenJDK.

  1. Download and extract the installation archive, and move the directory obtained after extraction to a specified directory (for example, /opt/tools/installed/).
    1
    2
    3
    4
    wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09/OpenJDK8U-jdk_aarch64_linux_hotspot_8u252b09.tar.gz --no-check-certificate
    tar -zxf OpenJDK8U-jdk_aarch64_linux_hotspot_8u252b09.tar.gz
    mkdir -p /opt/tools/installed/
    mv jdk8u252-b09 /opt/tools/installed/
    
  2. Configure Java environment variables.
    1. Open the /etc/profile file.
      1
      vi /etc/profile
      
    2. Press i to enter the insert mode and add the following content to the end of the file:
      1
      2
      export JAVA_HOME=/opt/tools/installed/jdk8u252-b09
      export PATH=$JAVA_HOME/bin:$PATH
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Make the environment variables take effect.
    1
    source /etc/profile
    
  4. Check whether OpenJDK is successfully installed.
    1
    java -version
    

    If the following information is displayed, the installation is successful.