How to install Java on Linux
Java components needed to run a variety of applications and web sites, so virtually every computer user is confronted with the need of the installation of this platform. Of course, different operating systems, the principle of the task is different, but the Linux distributions it is always the same, and we’d like to tell you how to install Java in Ubuntu. The owners of other assemblies will only need to repeat the instructions given the syntax of the system.
Install Java JRE / JDK in Linux
Today, we offer different options for installation of the Java libraries because they will be most useful and applicable in certain situations. For example, if you do not want to use third party repositories or want to put some Java nearby, then you need to use a separate option. However, let’s take a closer look at them all.
First, it is recommended to check the updates to the system repositories and the current version of Java, even if it is present in the OS. This is all done through the standard console:





Method 1: Official repositories
The simplest method is to use the official repository to download Java, which is unloaded there by the developers. You have to register a few commands to add all the necessary components.





Though this method is quite simple, it is not suitable for the installation of the latest Java libraries as they are not recently laid out in the official repository. That’s why we offer you to familiarize yourself with the following installation configurations.
Method 2: The Webupd8 Repository
There is a custom store called Webupd8, which has a script that compares the current Java version from the one on the Oracle website. This method of installation is useful to those who wish to install the newer 8 compiling it (the latest available in the repository Oracle).








At the end of the process you will be available to the team to install any of the versions — sudo apt-get install oracle-java7-installer, where java7 — version Java. For example, you can register java9 or java11.
To get rid of unnecessary installers, use the command sudo apt-get remove oracle Java 8 at-installerwhere Java 8 at version Java.
Method 3: Update using Webupd8
Above, we talked about installing assemblies by using a custom repository Webupd8. Thanks to the repository, you can upgrade Java to the latest just by script comparison.


Method 4: Manual install
Perhaps this method is the most heavy of those that we reviewed in this article, but it will allow you to obtain the necessary version of Java without using third-party repositories, and other additional components. For this purpose you will need any available browser and “Terminal”.







sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.8.0/bin/java 1
sudo update-alternatives –install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 1
sudo update-alternatives –install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 1

One of several alternative paths may not exist, depending on the chosen version of Java.



As you can see, the methods of installation of Java in Linux operating system there are quite a number, so each user will find a suitable option. If you are using a specific distribution, and these methods do not work, carefully review that appears in the error and use the official sources to solve the problem.