How to Install Java Runtime in Ubuntu

Java is not installed by default in , but it is required to run Java applications, such as Minecraft, on your computer. This article will show you how to install Java in Ubuntu.

What Is Java Runtime?

Java is an “interpreted” language, which means the code is not compiled into a ready-to-run executable. To run Java applications, you need to have a translator, known as a “runtime.” This runtime translates the program’s code in real time to instructions our computers understand, allowing us to run it.

Check for Java

To check if you already have Java installed, use:

Install Jre In Ubuntu Check Java Version

The output will tell you if you already have Java on your computer, and if not, which versions are available to install. Note them down, as you might need them later.

Install Default Version

Out of all available versions of Java, one will be deemed “the default” for your distribution. It might not be a bleeding-edge version, but it’s usually the latest one that is considered stable, secure, and generally “the best” for most uses.

To install it, use:

Install Jre In Ubuntu Install Default Jre

After a while, and the installation of some extra dependencies, Java will be installed on your computer.

Install Jre In Ubuntu Installed Default Jre

Use the -version command again to check which version was installed.

Install Jre In Ubuntu Rerun Java Version

Unfortunately, though, some programs that are created for a specific version of Java might run into problems when using different ones. Thankfully, there are solutions to such problems.

JRE and JDK

To run Java code, you need the Java runtime. In rare cases, though, some related extras may be needed. They can be found in the full-blown Java Development Kit.

To install it, enter in your terminal:

Install Jre In Ubuntu Install Default Jdk

Install (and Switch to) Older Versions

If what you’re trying to run still fails, install an older version of Java just like you did for the default runtime. For example, to install the oldest version available at this time for Ubuntu 20.04, we used:

Install Jre In Ubuntu Install Older Jdk

You don’t have to uninstall the Java version that’s already installed. Many versions can coexist in parallel. Only one of them is active at any given time, though. Even if you install an older version, that won’t solve the problem of not being able to run that jar file automatically. You first have to switch to the older version. To do that, use:

Install Jre In Ubuntu Config Java

A numbered list of the available versions will appear in your terminal. An asterisk before the number will mark the active one. Press Enter on your keyboard to keep the active one or the number that corresponds to a different version followed by Enter to switch to it.

Install Jre In Ubuntu Select Java Version

Install Oracle Java

Stubborn programs may refuse to work with any open version of Java, demanding Oracle’s version. Unfortunately, installing Oracle’s Java is a bit more complicated. You have to manually download it first from Oracle’s official Java page.

Install Jre In Ubuntu Oracle Java Download

Save the file somewhere, fire up a terminal and move to the same directory. Unleash dpkg on the downloaded file with:

Use the “update-alternatives” command we saw before to actually install the JDK with:

Remember to update the paths of the example for the version of Java you’re installing. Also note that you can switch between the “open” and Oracle’s version of Java like we saw before.

With Java installed, you can install and play Minecraft on Ubuntu.

You might also like More from author

Leave A Reply

Your email address will not be published.