Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»JAVA»How to Install Java 11/8 on Amazon Linux

    How to Install Java 11/8 on Amazon Linux

    RahulBy RahulOctober 5, 20192 Mins ReadUpdated:October 31, 2020

    This tutorial will help you to install Java 11 or Java 8 on the Amazon Linux system. As of now, Oracle has restricted these Java versions for registered users only, we will use OpenJDK for this installation.

    Step 1 – Install Java on Amazon Linux

    The OpenJDK 8 is available under default yum repositories and OpenJDK 11 is available under Amazon Linux 2 extras repositories. You can simply install Java 11 or Java 8 on the Amazon Linux system using the following commands.

    • Run below commands to install Java 11 on Amazon Linux:
      sudo amazon-linux-extras install java-openjdk11
      
    • Run below commands to install Java 8 on Amazon Linux:
      sudo yum install java-1.8.0-openjdk
      

    Step 2 – Check Active Java Version

    After successfully installing Java on Amazon Linux using the above steps, Let’s verify the installed version using the following command.

    java -version
    
    openjdk version "1.8.0_222"
    OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
    OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
    

    Step 3 – Switch Java Version

    Use alternatives command-line utility to switch active Java version on your Amazon Linux system. Run below command from the command line and select the appropriate Java version to make it default.

    alternatives --config java
    

    Install Java on Amazon Linux

    After switching let’s check again active Java version:

    java -version
    
    openjdk version "11.0.7" 2020-04-14 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
    

    Conclusion

    In this tutorial, you have learned to install Java 11 and Java 8 on Amazon Linux system. You also found instructions to switch between multiple java versions.

    Amazon Linux install java Java Java 11 java 8
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Check IP Address on CentOS 8
    Next Article How to Install Java 11/8 on Fedora

    Related Posts

    How to Install JAVA on Ubuntu 22.04

    Updated:May 16, 20224 Mins Read

    Java HashMap – How to Get Value from Key

    Updated:April 6, 20222 Mins Read

    Java HashMap – How to Get Key from Value

    Updated:April 6, 20222 Mins Read

    5 Methods to Print an Array in Java

    Updated:April 21, 20222 Mins Read

    How To Install Java on Debian 11

    4 Mins Read

    How to Install Tomcat 10 on Ubuntu 20.04

    Updated:February 18, 20226 Mins Read

    10 Comments

    1. Power on June 1, 2022 8:05 am

      permission denied when i tried to run : alternatives –config java

      Reply
    2. M on February 5, 2022 8:56 am

      PLEASE BE NOTICED : this installation is not installing JDK8, only JRE is installed !!

      Reply
    3. Rakesh on July 25, 2021 9:59 am

      This was helpful, thank you!

      Reply
    4. ravi jagannadh on June 22, 2021 2:59 am

      very helpful, thank you very much

      Reply
    5. Oleg on April 4, 2021 1:22 am

      It installs Open JRE only and not JDK

      javac -version returns nothing

      Reply
    6. Cleiton on March 21, 2021 11:25 pm

      Very helpful, thanks!

      Reply
    7. sachith soorage on January 12, 2021 1:30 pm

      Thanks

      Reply
    8. Luis on October 1, 2020 9:51 pm

      Gracias

      Reply
    9. raksha on June 9, 2020 9:29 am

      Thank you

      Reply
    10. Jim on December 24, 2019 2:58 am

      This is for amazon linux 2, not amazon linux

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.