How to Install JDK in Linux

Method 1 of 2:

Using Ubuntu or Linux Mint

  1. How to Install JDK in Linux Picture 1
    Press Ctrl+Alt+T to open a new terminal window. If you're already at the command prompt, just skip to the next step.
  2. How to Install JDK in Linux Picture 2
    Type sudo add-apt-repository ppa:linuxuprising/java and press Enter. This adds the Linux Uprising repository.[1]
  3. How to Install JDK in Linux Picture 3
    Type sudo apt update and press Enter. Now that the repository is ready, you can use it to install JDK.
  4. How to Install JDK in Linux Picture 4
    Type sudo apt install oracle-java12-installer and press Enter. JDK is now installed.
  5. How to Install JDK in Linux Picture 5
    Type sudo apt install oracle-java12-set-default and press Enter. This sets Java 12 as the default Java version.
    1. To double-check the default version, type java --version at the command prompt and press Enter.
Method 2 of 2:

Using Debian

  1. How to Install JDK in Linux Picture 6
    Press Ctrl+Alt+T to open a new terminal window. If you're already at the command prompt, just skip to the next step.
  2. How to Install JDK in Linux Picture 7
    Type su - and press Enter.
  3. How to Install JDK in Linux Picture 8
    Add the Linux Uprising repository. Here's how:
    1. Type echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" and press Enter.
    2. Type apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A and press Enter.
  4. How to Install JDK in Linux Picture 9
    Type apt-get update and press Enter.
  5. How to Install JDK in Linux Picture 10
    Type apt-get install oracle-java12-installer and press Enter.
  6. How to Install JDK in Linux Picture 11
    Type exit and press Enter. JDK is now installed.
  7. How to Install JDK in Linux Picture 12
    Type sudo apt install oracle-java12-set-default and press Enter. This sets Java 12 as the default Java version.
    1. To double-check the default version, type java --version at the command prompt and press Enter.
3.5 ★ | 2 Vote

May be interested

  • How to install Spotify on LinuxHow to install Spotify on Linux
    spotify has actually supported linux for a long time. although most distributions do not include this application in the repository for license reasons, it is not really difficult to install this official player on a linux pc.
  • How to Install VirtualBox on LinuxHow to Install VirtualBox on Linux
    setting up a virtual machine can be a great way to test alternative software or operating systems on a computer without altering or putting the existing system at risk.
  • How to install Deepin LinuxHow to install Deepin Linux
    deepin linux is an excellent distribution. so why not experience it on your computer? deepin has a variety of high-quality layouts / interfaces and great software.
  • How to Install Asahi Linux on an Apple Silicon MacHow to Install Asahi Linux on an Apple Silicon Mac
    asahi linux is a project to port the linux kernel and related software to macs powered by apple silicon. it is still under development, but it has made significant progress in a short period of time.
  • How to install and use TeamViewer on LinuxHow to install and use TeamViewer on Linux
    teamviewer is a powerful tool that allows teams to collaborate and share their screens in real time. it is also extremely useful in remote technology support.
  • How to Install LinuxHow to Install Linux
    linux is the foundation of thousands of open source operating systems designed to replace windows and mac os. linux allows users to download and install it for free on any computer. because this is an open source platform, the number of available versions or distributions is very diverse and is developed by many different organizations. follow the basic instructions below to install all linux versions, especially some of the most popular distributions.
  • Should I install Arch Linux?Should I install Arch Linux?
    arch linux is one of the most popular linux operating systems. arch linux is even easier to install than arch-based distributions like manjaro and antergos.
  • How to install Handbrake on LinuxHow to install Handbrake on Linux
    handbrake is a powerful open source tool for encoding and editing videos. it includes a graphical control panel to manage encryption and even preview the results.
  • How is Arch Linux different from other Linux versions?How is Arch Linux different from other Linux versions?
    arch linux is arguably the most misunderstood linux distribution. many people find arch difficult to install and maintain.
  • How to install and remove fonts on LinuxHow to install and remove fonts on Linux
    the linux system has many integrated fonts but you still can't find the font you need. downloading and installing new fonts is very easy on linux and we will show you how to do this in the following article.