1080*80 ad

How to Install Oracle Java 12 on Ubuntu 18.04 and Debian 9.8

Installing a specific version of Java can sometimes be necessary for compatibility with certain applications, development environments, or older projects. If you’re working with Ubuntu 18.04 or Debian 9.8 and need Oracle Java 12, this guide outlines the process to get it set up on your system. While newer Java versions exist, sometimes the requirement dictates using a particular release like Java 12.

Here’s a straightforward approach to install Oracle Java 12 on these Linux distributions:

1. Prepare Your System

Before starting, ensure you have administrative privileges (sudo access) and a stable internet connection. Open your terminal application to begin.

2. Add the Necessary Repository

Oracle Java is not typically found in the default package repositories of Ubuntu or Debian due to licensing. You’ll usually need to add a third-party repository (often a PPA for Ubuntu or a similar method for Debian) that provides packaged versions.

This step makes the Oracle Java package available to your system’s package manager (apt). The specific commands to add the repository will depend on the provider of the package, but it often involves adding a repository source and its public key. Follow the instructions carefully for the specific repository you choose to use.

3. Update Your Package List

After adding a new repository, it’s crucial to update your system’s list of available packages. This ensures that the package manager knows about the newly added software.

Run this command in your terminal:

sudo apt update

4. Install Oracle Java 12

Now that your system knows where to find the package, you can proceed with the installation. The package name for Oracle Java 12 is typically something like oracle-java12-installer.

Execute the installation command:

sudo apt install oracle-java12-installer

During the installation process, you might be prompted to accept the Oracle Binary Code License Agreement for Java SE. Read the license terms and accept them to continue the installation.

5. Verify the Installation

Once the installation completes without errors, it’s a good practice to verify that Java 12 was installed correctly and is recognized by your system.

Run the following command:

java -version

You should see output indicating Java(TM) SE Runtime Environment 12 and detailing the version number. If you see a different version or an error, double-check the previous steps.

6. Configure Java Alternatives (If Needed)

If you have multiple Java versions installed on your system, you might need to explicitly set Oracle Java 12 as the default version. You can use the update-alternatives command for this.

Run the configuration tool:

sudo update-alternatives --config java

This command will display a list of all installed Java executables, each with a selection number. Enter the selection number corresponding to the Oracle Java 12 path and press Enter to set it as the default. Repeat the process for the javac (Java compiler) alternative if necessary:

sudo update-alternatives --config javac

Final Steps

After completing these steps, Oracle Java 12 should be successfully installed and configured on your Ubuntu 18.04 or Debian 9.8 system. You can now use it for compiling and running Java applications that require this specific version. Remember that keeping your operating system updated is always a good security practice, even when using specific software versions.

Source: https://kifarunix.com/install-oracle-java-12-on-ubuntu-18-04-debian-9-8/

900*80 ad

      1080*80 ad