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
- 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
May be interested
- How to install Java on the computerhow to install java on the computer. currently, there are still a lot of applications running on the computer on java, so installing java on the computer is a must. for example, those of you who are accountants who regularly have to file electronic tax returns are definitely ph
- How to install multiple Java versions on CentOS 8java is one of the most widely used high-level programming languages. in this article, readers will learn how to install different versions of java on centos 8.
- How to Upgrade Oracle Java on Ubuntu Linuxthis document is intended to assist with the upgrade of the many new release versions of oracle java jdk/jre on ubuntu linux. every so often, due to bug fixes and security issues oracle releases updates to their version of the java...
- What is Java? Why choose Java?what is java? java is a high-level programming language, developed by sun microsystem and released in 1995. java runs on a variety of platforms, such as windows, mac and various versions of unix.
- How to Tune a Java Virtual Machine (JVM)the java virtual machine (jvm) runs your java programs. sometimes the default configuration that the jvm comes with may not be the most efficient for your program.
- How to Install Android on Ubuntu Linux with Eclipse IDEthis document will prepare an overview of the steps you will take to install and configure android on your ubuntu linux system. you must have oracle java jdk or openjdk on your system before installing android sdk. openjdk (aka open java...
- Search and launch Java Control Panel on Windows operating systemin java control panel you can search and change java settings. in the following article, network administrator will show you how to search for java control panel on windows operating system.
- Basic Java syntaxa java program can be defined as a collection of objects, communicating through calling each other's procedures. now we will look at the class, object, procedure and instance variable / instance variable to consider their meaning.
- How to install and use Kali Linux on VmWare virtual machineuntil now, a famous linux distro, kali linux, has always been sought by security experts or hackers. why? simply because kali linux has a built-in range of tools for penetration, hacking, analysis, etc. all are categorized very clearly.
- How to install Solus Linuxrecently, the linux community has given winged compliments to solus linux. this is understandable because this is a beautiful operating system with lots of great features. in a world where most popular linux distributions are 'derivative ubuntu', solus linux really stands out.