try using this command in the terminal:

sudo apt install default-jre

then you can try using:

java -version

to check version

Answer from neoMidori on askubuntu.com
🌐
Oracle
java.com › en › download › help › linux_x64_install.html
Linux 64-bit installation instructions for Java
Type: cd directory_path_name For example, to install the software in the /usr/java/ directory, Type: cd /usr/java/ Move the .tar.gz archive binary to the current directory. Unpack the tarball and install Java tar zxvf jre-8u73-linux-x64.tar.gz The Java files are installed in a directory called jre1.8.0_73 in the current directory.
🌐
Ubuntu
ubuntu.com › tutorials › install-jre
Install the Java Runtime Environment | Ubuntu
Create a directory to install JRE in with: sudo mkdir /usr/local/java · Move the JRE binaries into the directory: sudo mv jre-8u291-linux-x64.tar.gz /usr/local/java · Go into the install directory: cd /usr/local/java · Unpack the tarball: ...
Discussions

How do I install Java JRE on Linux?
Do you need to install Oracle's Java? Cuz if you don't need you can just open a terminal and type sudo apt install default-jre -y and it's ready to use (if you're on debian-based distros) More on reddit.com
🌐 r/linuxquestions
15
7
February 16, 2021
Where is Java/the JDK installed on Linux?
Both rpm and dpkg systems typically use the "alternatives" system to support multiple installs of packages like java, so you can find yours like so: $ which java /usr/bin/java $ ls -l /usr/bin/java lrwxrwxrwx. 1 root root 22 Jan 29 15:08 /usr/bin/java -> /etc/alternatives/java* $ ls -l /etc/alternatives/java lrwxrwxrwx. 1 root root 72 Jan 29 15:08 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b13-0.fc29.x86_64/jre/bin/java* My install of Java is in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b13-0.fc29.x86_64 More on reddit.com
🌐 r/linux4noobs
9
6
February 16, 2019
How do I install Java?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
27
2
April 14, 2024
Help getting started developing in linux

Java is a write once, run anywhere language, meaning you don't need anything special other than the JDK and a Linux compatible IDE.

For the JDK you can either use OpenJDK (An opensource implementation of Java / JDK) or Oracle's JDK (Original and most used JDK). OpenJDK is easily available through sources like Ubuntu's Software Centre whereas Oracle's JDK is a bit more painful to install (Depending on the distro), but this is a great resource to make it easier (For Debian based systems like Ubuntu).

As for an IDE you're already on the right track. Both Eclipse and IntelliJ are great options and have cross-platform support.

More on reddit.com
🌐 r/java
8
0
August 12, 2012
🌐
Oracle
java.com › en › download › help › linux_install.html
How do I download and install 32-bit Java for Linux?
Type: cd directory_path_name For example, to install the software in the /usr/java/ directory, Type: cd /usr/java/ Move the .tar.gz archive binary to the current directory. Unpack the tarball and install Java tar zxvf jre-8u73-linux-i586.tar.gz The Java files are installed in a directory called jre1.8.0_73 in the current directory.
🌐
Opensource.com
opensource.com › article › 19 › 11 › install-java-linux
How to install Java on Linux | Opensource.com
Finally, unarchive the tarball into the directory you've chosen. $ tar --extract --file openjdk*linux-x64_bin.tar.gz \ --directory=$HOME/bin · Java is now installed.
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › download-install-java-windows-linux-macos
Installing Java on Windows, Linux, and macOS - GeeksforGeeks
April 20, 2026 - Step 1: Visit the official oracle ...racle.com/in/java/. You will need to accept the terms of Oracle’s license agreement before downloading. On the download page, accept the Oracle Binary Code License Agreement for Java SE. Select the Linux version. If you are using a standard 64-bit system, select the file for x64 architecture. If you are using an ARM-based system, select the file for arm64. Download the ....
Find elsewhere
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › How-do-I-install-Java-on-Ubuntu
How to install Java 21 on Ubuntu
To validate the successful install of Java on Ubuntu, and to ensure the JDK’s bin directory is accessible through the OS’s PATH variable, issue the following command: java -version openjdk version "21.0.5" 2024-10-15 OpenJDK Runtime Environment (21.0.5+11-1ubuntu~24.04.11) OpenJDK 64-Bit Server VM (21.0.5+11-1ubuntu~24.04.1, mixed mode, sharing) If the java -version command outputs information about the version of Java installed, along with information about the JVM and runtime environment, then you successfully installed Java on Ubuntu with apt.
🌐
Oracle
java.com › en › download › help › linux_x64rpm_install.html
Linux 64-bit RPM Java installation instructions
Type: cd directory_path_name For example, to install the software in the /usr/java/ directory, Type: cd /usr/java · Uninstall any earlier installations of the Java packages. ... Install the package. rpm -ivh jre-8u73-linux-x64.rpm To upgrade a package: rpm -Uvh jre-8u73-linux-x64.rpm
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › install › installation-jdk-linux-platforms.html
3 Installation of the JDK on Linux Platforms
July 15, 2025 - 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 and instructions for downloading and installing the JDK 21 release on a Linux platform: You can install the ...
🌐
OperaVPS
operavps.com › docs › install java in linux easily and quickly
✅ Install Java in Linux Guide Step by Step
1 month ago - Installing Java in Linux involves using the native package manager like apt or yum to check existing installations, update the system, install the Java Development Kit or Runtime Environment, and verify the setup.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install java on ubuntu
How to Install Java on Ubuntu
February 20, 2025 - Install one or several Java packages on your system, or choose a specific version by specifying the version number. By default, Ubuntu includes OpenJDK as the Java Development Kit (JDK) and Java Runtime Environment (JRE).
🌐
Scaler
scaler.com › home › topics › java › how to install java in linux?
How to Install Java in Linux? - Scaler Topics
July 5, 2024 - From the above explanations, we know that JDK contains all the required components(JVM, JRE, compiler, and debugger) to execute a Java program. So, we will download and install JDK 16. NOTE: Here, we will install default versions available in the Linux operating system repository.
🌐
Wikihow
wikihow.com › computers and electronics › operating systems › linux › 4 ways to install java on linux - wikihow
4 Ways to Install Java on Linux - wikiHow
May 1, 2026 - Enter the installation command. Type in tar zxvf, press the spacebar once, and then type in the full file name. This will vary depending on the Java version and when you downloaded it. As of October 2017, you'd type in tar zxvf jre-8u151-linux-i586.tar.
🌐
LinuxConfig
linuxconfig.org › home › linux: install java
Install Java on Linux: JDK vs JRE Guide
September 21, 2025 - Learn how to install Java on Linux distros including Ubuntu and Fedora. Covers JDK vs JRE differences, version search, and installation verification.
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › install-java-linux
How to Install Java on Linux: Step By Step Installation Guide
April 23, 2026 - Execute the command sudo apt install default-jre to download and install the default JRE version available in your Linux distribution's repository, whether you're using Linux Mint vs.
🌐
GeeksforGeeks
geeksforgeeks.org › techtips › how-to-install-java-in-ubuntu
How to install Java in Ubuntu - GeeksforGeeks
February 14, 2026 - Command: sudo apt install default-jdk · Command: sudo apt install default-jre · If installed successfully, the system will display the installed Java version. Command: java -version · Hooray!
🌐
Lbl
pipeline.lbl.gov › vgb2 › help › java_linux_instructions.shtml
Instructions for installing Java on Linux
$ cd ~/Distribs $ pwd .../Distribs $ ls -l total 13288 -rw------- 1 username username 13582366 Jan 9 14:35 j2re-1_4_2_03-linux-i586-rpm.bin $ chmod 700 j2re-1_4_2_03-linux-i586-rpm.bin $ ./j2re-1_4_2_03-linux-i586-rpm.bin · The program will print out the license agreement, to which you must agree by typing "yes" at the prompt. As a result, a file will be created in the current directory with the same name and an rpm extension. ... If during the install process the program prints error messages, they need to be analyzed -- you may be missing some libraries, which will need to be installed prior to Java.