How to Install JDK in Linux
Method 1 of 2:
Using Ubuntu or Linux Mint
- Press Ctrl+Alt+T to open a new terminal window. If you're already at the command prompt, just skip to the next step.
- Type sudo add-apt-repository ppa:linuxuprising/java and press ↵ Enter. This adds the Linux Uprising repository.[1]
- Type sudo apt update and press ↵ Enter. Now that the repository is ready, you can use it to install JDK.
- Type sudo apt install oracle-java12-installer and press ↵ Enter. JDK is now installed.
- Type sudo apt install oracle-java12-set-default and press ↵ Enter. This sets Java 12 as the default Java version.
- To double-check the default version, type java --version at the command prompt and press ↵ Enter.
Method 2 of 2:
Using Debian
- Press Ctrl+Alt+T to open a new terminal window. If you're already at the command prompt, just skip to the next step.
- Type su - and press ↵ Enter.
- Add the Linux Uprising repository. Here's how:
- Type echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" and press ↵ Enter.
- Type apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A and press ↵ Enter.
- Type apt-get update and press ↵ Enter.
- Type apt-get install oracle-java12-installer and press ↵ Enter.
- Type exit and press ↵ Enter. JDK is now installed.
- Type sudo apt install oracle-java12-set-default and press ↵ Enter. This sets Java 12 as the default Java version.
- To double-check the default version, type java --version at the command prompt and press ↵ Enter.
3.5 ★ | 2 Vote
You should read it
May be interested
- How to install Spotify on Linuxspotify 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 Linuxsetting 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 Linuxdeepin 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 Macasahi 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 Linuxteamviewer 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 Linuxlinux 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?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 Linuxhandbrake 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?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 Linuxthe 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.