How to Install Java on Linux
Install on Non-RPM Linux
Open the Java for Linux download page . You will see several options.
Click Linux . This link is in the middle of the page. The Java installation file will be downloaded.
You can also click on the Linux X64 version if you want to install 64-bit Java.
Record the file name. The latest Java version is version 8, but you may also need the update version number after the "8u" part at the end of the file name.
For example, your file might be called "jre-8u151", which is version 8, update 151.
Open the command line. This step will vary depending on your version of Linux, but you can usually find the command line by opening the Terminal app or clicking the bar at the top or bottom of the screen.
Change installation directory. Type cdinto the console, press spacebar once, then enter the path (e.g. /usr/java/enter then press ↵ Enter.
Enter the installation command. Type tar zxvf, press spacebar once, then enter the full name of the file. This operation depends on the Java version and when you downloaded it.
As of October 2017, you will have to enter tar zxvf jre-8u151-linux-i586.tar.
Press ↵ Enter. Java will be installed on the computer in a folder titled "jre1.8.0_[update]" where "[update]", where 'update' is the version number (e.g. 151).
Install on RPM Linux
Open the Java for Linux download page . You will see several options.
Click Linux RPM in the middle of the page. The Java installation file for the RPM will be downloaded.
You can also click on the Linux RPM X64 version if you want to install 64-bit Java.
Record the file name. The latest Java version is version 8, but you may also need the update version number after the "8u" part at the end of the file name.
For example, your file might be called "jre-8u151", which is version 8 and update 151.
Open the command line. This step will vary depending on your version of Linux, but you can usually find the command line by opening the Terminal app or clicking the bar at the top/bottom of the screen.
Enter the root command. Type sudo suand press ↵ Enter. The command line will ask for the user password.
Enter your account password. Type in the account password and press ↵ Enter. As long as you have root (or root) access on the account, this will allow you to install Java.
If you don't have root access on the account, you need to enter the password of the account that has root access.
Change installation directory. Type cdinto the console, press spacebar once, then enter the path (e.g. /usr/java/enter then press ↵ Enter.
Enter the installation command. Type rpm -ivh, press space once, enter the full name of the file, then press ↵ Enter. Java will be installed on the computer.
The file name will depend on when you download it. As of October 2017, you will have to enter rpm -ivh jre-8u151-linux-i586.rpmthen press ↵ Enter.
Upgrade downloaded files. Enter rpm -Uvh jre-8u73-linux-i586.rpmand press ↵ Enter. This will check for updates to the Java package and apply them if possible.
Install on Ubuntu (OpenJDK)
Open the command line. Press Ctrl+ Alt+ Ton your keyboard or click the black frame icon with a white ">_" on the left side of the screen.
Enter the update command. Type sudo apt-get update && sudo apt-get upgrade -yand press ↵ Enter. The package list will refresh and install all available updates for you.
Enter your password if asked. If you are asked to enter your user password, enter it and tap ↵ Enter.
You need to make sure Java is not installed. Enter java -versionand press ↵ Enter. If you see the message "The program 'java' can be found in the following packages" (The java program can be found in the following packages), Java is not installed on your computer.
If Java is installed, you will see a command line reporting the current version of Java on your computer.
Enter the installation command. Enter sudo apt-get install default-jrethe command line, then press ↵ Enter. Java will be installed into the default directory on the Ubuntu computer.
If this command doesn't work, try entering sudo apt-get install openjdk-8-jdkinstead
Install on Ubuntu 16.04 via PPA
First of all, this is a third-party installation package, so the Linux distribution's package management system (often referred to as distro) cannot inventory this package, so you need to be careful when using it. CtrlEven so, you still have to press + Alt+ Tto open the terminal first .
You need to make sure the system is up to date. After entering sudo apt-get update && sudo apt-get upgrade -y, the system will prompt you to enter the password, type the password and press ↵ Enter, note that no dots or asterisks will appear when you enter and this is normal.
Although this step is not technically required, it is always recommended to do it before we install any content, so you should keep the system up to date to limit many problems.
Add PPA repository to the system. Enter sudo add-apt-repository ppa:webupd8team/javathen press ↵ Enter.
Update the package lists again. Please type sudo apt-get updateand wait for the packages to be refreshed.
Install the package. Enter sudo apt-get install oracle-java9-installer -y.
You may be asked to enter your password, then enter it and press ↵ Enter, note that no dots or asterisks will appear as you enter and this is normal.
Set Oracle's Java as default. On many Ubuntu derivatives, OpenJDK is often the default Java used. If you want Oracle's Java to be used as default, you need to import sudo apt install oracle-java9-set-default.
You should read it
- How to Install Java on Linux
- How to Install Oracle Java JRE on Ubuntu Linux
- Download and install Java on the computer
- How to install Java on a Raspberry Pi
- How to Install JDK in Linux
- How to fix the error does not install Java
- How to Install Oracle Java on Ubuntu Linux
- How to Set Java Home
- How to install Java Runtime in Ubuntu
- How to Enable Oracle Java in Your Web Browsers on Ubuntu Linux
- How to install Java on the computer
- How to install multiple Java versions on CentOS 8
Maybe you are interested
Latest Sword Master Story Code and How to Enter Code
Latest Anime Squad Simulator Codes and How to Enter Codes
How to Center Taskbar Icons in Windows 10
Latest LaLa Land Code Mysterious Continent and how to enter code
Latest Holy Sword Reincarnation Code and how to enter
How to use Presenter View in Google Slides