How do you install JRE and run it on Linux?
You can install JRE (Java Runtime Environment) on Linux by following these steps.
- Open the terminal and type the following command to install the default version of JRE:
sudo apt-get update
sudo apt-get install default-jre
- Before installing a specific JRE version, you can first check the available JRE versions.
sudo apt-cache search openjdk
Next, choose the version you want to install and use the following command to proceed with the installation (using OpenJDK 11 as an example):
sudo apt-get install openjdk-11-jre
- After the installation is complete, you can use the following command to verify if the JRE has been successfully installed:
java -version
If you see the following output, it means that the JRE has been successfully installed.
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
After installation, you can run Java applications written using JRE on Linux.