Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?,

How to install Open JDK (Java developement kit) in Ubuntu (Linux)?

  1. Open Terminal from Application Dash or press Ctrl+Alt+T

  2. Update repository:

    sudo add-apt-repository ppa:openjdk-r/ppa  # only Ubuntu 17.4 and earlier
    sudo apt update
    
  3. Optional: To search available distributions of openjdk, use the following command:

    apt search openjdk
    
  4. Install the appropriate version with the following command:

    sudo apt install openjdk-8-jdk
    sudo apt install openjdk-8-source #this is optional, the jdk source code
    
  5. For JAVA_HOME (Environment Variable) type command as shown below, in "Terminal" using your installation path...

    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
    

    (Note: /usr/lib/jvm/java-8-openjdk is symbolically used here just for demostration. You should use your path as per your installation.)

  6. For PATH (Environment Variable) type command as shown below, in Terminal:

    export PATH=$PATH:$JAVA_HOME/bin

  7. To check your installation:

    java -version

Answer from Dhaval Shah on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › download-and-install-jdk-on-windows-mac-and-linux
Download and Install JDK on Windows, Mac and Linux - GeeksforGeeks
April 4, 2026 - C:\Program Files\Java\jdk-{YOUR_JDK_VERSION}. Click on OK => OK => OK. ... Follow the steps below to install the Java software Development Kit on a Linux environment. These instructions are applicable to various Linux distributions such as Ubuntu, ...
🌐
Oracle
docs.oracle.com › en › java › javase › 22 › install › installation-jdk-linux-platforms.html
3 Installation of the JDK on Linux Platforms
March 14, 2024 - The following table lists the differences: Table 3-1 Difference between Generic Linux and OL platforms ... Access Java SE Downloads page and click Accept License Agreement. Under the Download menu, click the Download link corresponding your requirement. The following table lists the options ...
🌐
OpenJDK
openjdk.org › install
OpenJDK: Download and install
Oracle's OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives. As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using ... The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › guides › install › linux_jdk.html
6 JDK Installation for Linux Platforms
April 21, 2026 - To install the JDK on an RPM-based Linux platform: ... For aarch64 (64-bit ARM) systems: jdk-8uversion-linux-aarch64.rpm. For example, jdk-8u381-linux-aarch64.rpm · For 32-bit systems: jdk-8uversion-linux-i586.rpm. For example, jdk-8u381-linux-i586.rpm · Before you download a file, you must accept the license agreement.
🌐
Oracle
java.com › en › download › help › linux_x64_install.html
Linux 64-bit installation instructions for Java
This procedure installs the Java Runtime Environment (JRE) for 64-bit Linux, using an archive binary file (.tar.gz). Go to http://java.com and click on the Download button.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-install-java-in-ubuntu
How to Install Java in Ubuntu – JDK Linux Tutorial
August 11, 2024 - Use the sudo apt install /home/fahim/Downloads/jdk_filename.deb command to start the installation. For me, the entire command is sudo apt install /home/fahim/Downloads/jdk-20_linux-x64_bin.deb.
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-jdk-in-linux
How to Install JDK in Linux? - GeeksforGeeks
July 23, 2025 - Here we are going to install JDK in the Debian-based Ubuntu operating system. Step 1: Open your browser and navigate to this link. Step 2: Scroll down and click on the JDK download link.
Find elsewhere
🌐
Oracle
oracle.com › java › technologies › downloads
Download the Latest Java LTS Free
Subsequent JDK 25 updates will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee. Linux · macOS · Windows · Documentation Download · Online Documentation · Installation Instructions ·
🌐
Oracle
docs.oracle.com › javase › 10 › install › installation-jdk-and-jre-linux-platforms.htm
5 Installation of the JDK and JRE on Linux Platforms
To install the 64-bit JDK on an RPM-based Linux platform: Download the file, jdk-10.interim.update.patch_linux-x64_bin.rpm.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install java on ubuntu
How to Install Java on Ubuntu
February 20, 2025 - The sections below provide instructions for installing JDK from a third-party repository or by downloading and installing a .deb file.
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-openjdk-in-linux
How to Install OpenJDK in Linux - GeeksforGeeks
May 7, 2026 - All the steps are performed here in this guide on Ubuntu Linux distribution. Before installing any software, update your system packages. ... This ensures your system has the latest package information and updates installed. ... Note: After this command you need to enter you password. This will display a list of available OpenJDK versions. As of now, the latest stable version is OpenJDK 21. ... This command installs the OpenJDK Development Kit (JDK), which includes the Java Runtime Environment (JRE) and development tools like the javac compiler.
🌐
Fabric Documentation
docs.fabricmc.net › players › installing-java › linux
Installing Java on Linux | Fabric Documentation
April 2, 2026 - If you plan to develop mods, you'll need the JDK instead: sh · sudo dnf install java-25-openjdk-devel · 1 · If your distribution isn't listed above, you can download the latest JRE from Adoptium · You should refer to an alternative guide ...
🌐
GeeksforGeeks
geeksforgeeks.org › download-and-install-java-development-kit-jdk-on-windows-mac-and-linux
Download and Install Java Development Kit (JDK) on Windows, Mac, and Linux - GeeksforGeeks
April 8, 2025 - This article describes the step-by-step process for installing and configuring the JDK on Windows, Mac, and Linux. The JDK can be installed on the following Platforms: ... Go to the Official JDK website to download the file.
🌐
Oracle
docs.oracle.com › en › industries › hospitality › enterprise-integrations › gaming-integration › 24.1 › gamig › t_download_jdk17_for_linux.htm
Download JDK17 for Linux
April 22, 2024 - Select JDK17 and then select the Linux tab. Click the x64 RPM Package link to download jdk-17_linux-x64_bin.rpm.
🌐
Oracle
java.com › en › download › help › linux_x64rpm_install.html
Linux 64-bit RPM Java installation instructions
This procedure installs the Java Runtime Environment (JRE) for 64-bit RPM-based Linux platforms, such as Red Hat and SuSE, using an RPM binary file (.rpm) in the system location. You must be root to perform this installation. Go to http://java.com and click on the Download button.
🌐
GitHub
gist.github.com › filipelenfers › ef3f593deb0751944bb54b744bcac074
Install JDK from tar.gz Ubuntu · GitHub
download open jdk from https://www.openlogic.com/openjdk-downloads?field_java_parent_version_target_id=416&field_operating_system_target_id=426&field_architecture_target_id=391&field_java_package_target_id=396 ... cd /opt/ && \ tar xzf ...
🌐
Opensource.com
opensource.com › article › 19 › 11 › install-java-linux
How to install Java on Linux | Opensource.com
Java is now installed. There are probably many many Java-related packages in your repository. Search on OpenJDK and look for either the most recent JRE or JVM if you're a user and for the most recent JDK if you're a developer. If you can't find a JRE or JDK in your repository, or the ones you find don't fit your needs, you can download open source Java packages from the internet.