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.
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
I've downloaded the latest Java JRE, but how do I install it?
Installing Java on Linux is best done via the package manager. Most distos ship openjdk. More on reddit.com
🌐 r/linux4noobs
3
1
November 24, 2022
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
how to install `Eclipse JDT Language Server` correctly in a shell.nix file for a nix-shell project:
I played around with it a long time ago but eventually gave up on packaging jdtls. I now simply use lsp-install-server. I recall a big problem being that jdtls insisted on writing to its installation directory, which of course doesn't work with the Nix store. It's probably possible to get around with a bit of effort. More on reddit.com
🌐 r/NixOS
9
2
August 27, 2020
People also ask

What is Java command in Linux?
The Java command in Linux is used to launch the Java Virtual Machine (JVM) and execute Java programs. You need to install the Java Development Kit (JDK) to use the Java command. To run a Java program, you need to compile the source code with the javac command and then run the class file with the java command.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-java-linux
How to Install Java on Linux: Step By Step Installation Guide
What is Knowledge Pass, and how does it work?
The Knowledge Academy’s Knowledge Pass, a prepaid voucher, adds another layer of flexibility, allowing course bookings over a 12-month period. Join us on a journey where education knows no bounds.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-java-linux
How to Install Java on Linux: Step By Step Installation Guide
What are related courses and blogs provided by The Knowledge Academy?
The Knowledge Academy offers various Java Courses, including Java Programming, Hibernate Training and Introduction to Java EE Course. These courses cater to different skill levels, providing comprehensive insights into Latest Java Technologies Trends. Our Programming and DevOps blogs cover a range of topics related to Java Programming, offering valuable resources, best practices, and industry insights. Whether you are a beginner or looking to advance your Java Programming skills, The Knowledge Academy's diverse courses and informative blogs have you covered.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-java-linux
How to Install Java on Linux: Step By Step Installation Guide
🌐
Opensource.com
opensource.com › article › 19 › 11 › install-java-linux
How to install Java on Linux | Opensource.com
If you download an RPM or DEB file from Azul.com, then you can use your package manager to install it. For Fedora, CentOS, RHEL, and similar, download the RPM and install it using DNF: ... For Debian, Ubuntu, Pop_OS, and similar distributions, ...
🌐
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.
🌐
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
A quick java --version check will tell you if an install is necessary: java - version Command 'java' not found, but can be installed with: sudo apt install default-jre · If the command indicates that Java is not found, proceed with the next steps.
Find elsewhere
🌐
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 - To install the 64-bit JDK Debian ... install the archive file in any location having write access. ... The Java Development Kit files are installed into /usr/lib/jvm/jdk-<VERSION>-oracle-<ARCH> directory....
🌐
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.
🌐
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 - This step will vary depending on your version of Linux, but you can usually find the command line by opening the Terminal app or by clicking a bar at the top or bottom of the screen. ... Change the installation directory. Type cd into console, press the spacebar once, and then type in the path (e.g., /usr/java/ and press ↵ Enter.
🌐
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
🌐
Ubuntu
ubuntu.com › tutorials › install-jre
Install the Java Runtime Environment | Ubuntu
In this guide, we’ll be going through the installation of both JRE packages. Of course, you generally only need to pick the one that best suits your needs and preferences. ... That’s all you need. If you have that, let’s proceed to the next step! With new versions of Java released every 6 months, there are multiple versions available for use.
🌐
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 website https://www.oracle.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.
🌐
OperaVPS
operavps.com › docs › install java in linux easily and quickly
✅ Install Java in Linux Guide Step by Step
3 weeks 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.
🌐
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.
🌐
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.
🌐
LinuxVox
linuxvox.com › blog › how-to-install-java-on-linux
How to Install Java on Linux — linuxvox.com
Before installing Java, it's important to determine whether you need the JDK or just the JRE, as well as which Java version is compatible with your applications. Most Linux distributions come with package managers that simplify the software installation process. Here are examples for some popular distributions: ... Install the OpenJDK (Open-source Java Development Kit). For Java 11: ... Install the OpenJDK. For Java 11: ... If you need a specific Java version that is not available in the package manager or prefer a custom installation, you can manually install Java.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-on-ubuntu-22-04
How to Install Java with Apt on Ubuntu (JRE & JDK) | DigitalOcean
February 2, 2026 - Learn how to install Java (JRE & JDK) on Ubuntu using apt. Step-by-step guide to setting up Java, verifying installation, and managing multiple versions.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install java on ubuntu
How to Install Java on Ubuntu
February 20, 2025 - This step-by-step guide will show you how to install Java on Ubuntu. ... A user account with sudo or root privileges. Access to the terminal. An Ubuntu Linux system. Java is a versatile, high-level programming language for building applications across various platforms. To accommodate different use cases, Java is divided into ...
🌐
freeCodeCamp
freecodecamp.org › news › how-to-install-java-in-ubuntu
How to Install Java in Ubuntu – JDK Linux Tutorial
August 11, 2024 - You might get N: Download is performed unsandboxed as root as file '/home/fahim/Downloads/jdk-20_linux-x64_bin.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied). But don't worry about that because we performed the installation "unsandboxed" intentionally. You will not face any problems if you use the Debian package downloaded from the right source. You can clear the terminal using the command clear. We need to make sure that if it updates, it does not download any downgraded version of Java.