Installing Java in Ubuntu

Java is a programming language commonly used on both desktop and mobile devices. Perhaps the most popular and powerful technology for creating applications is Java. Therefore, it is not surprising that its support for Linux has been available for a long time - this is direct evidence of the multiplatform language.

Installing Java contributes to the expansion of Ubuntu functionality.

So that a user with a computer based on Ubuntu Linux can work with Java - a PC needs to be “trained” on this technology at the software level. When installing Java, Ubuntu significantly expands its functionality. Therefore, without the support of this language rarely manage to do.

What to install?

Those who write Java applications need a development kit. It also makes sense to install the Runtime Environment. These tools contain all the necessary devices for the full creation of programs. Next, we take a closer look at how to install Java on Ubuntu.

Installation

First you need to update the system repositories. This can be done by typing in the terminal:

"$ Sudo apt-get update"

Next, you need to check whether Java is currently present in the system. And if it is, which version is installed?

"$ Java -version"

If the computer does not have the required support, you will most likely see this:

"The program 'java' can be found in the following packages:

* default-jre

* gcj-4.9-jre-headless

* gcj-5-jre-headless

* openjdk-7-jre-headless

* gcj-4.8-jre-headless

* openjdk-6-jre-headless

* openjdk-8-jre-headless

* openjdk-9-jre-headless

Try: apt install »

Install the open source development kit - Runtime Environment.

"Sudo apt-get install openjdk-7-jre"

In the continuation of the work you need to confirm the issue of the system. To do this, press "Y".

By analogy, you can install and Java Development Kit:

"$ Sudo apt-get install openjdk-7-jdk"

Now we have to find and configure dependencies. Only installing Java with dependencies will be complete.

"$ Sudo apt-get install python-software-properties"

Add to the system the corresponding repository for the language:

"$ Sudo add-apt-repository ppa: webupd8team / java"

Update the repository info:

"$ Sudo apt-get update"

Install the package:

"$ Sudo apt-get -y install oracle-java8-installer".

To confirm the operations you will need to click "OK", perhaps several times. If the installation was successful, you will be notified with a message with the words "... plugin installed". Now we confirm the installation: "$ java —version". In response to the terminal command, you should receive something like the following message:

"Java version" 1.8.0_74 "

Java (TM) SE Runtime Environment (build 1.8.0_74-b02)

Java HotSpot (TM) 64-Bit VM Server (build 25.74-b02, mixed mode) »

The installed package set can be successfully used both for writing your own programs and for supporting the work of third-party software.

Additional variables

In the process of work may require variables. They are used in the work of some programs. This is especially true of software, which in its work relies on the programming language we need. This also applies to the “JAVA_HOME” variable.

First, determine the path by which Java was installed. Do this with the command:

“Sudo update-alternatives —config java”

As a response to this command, you should receive a message with installation paths and other data. Record or copy the installation path of the current Java version separately. Open the file “sudo nano / etc / environment”. Add the line “JAVA_HOME =” Your_path ””, where “Your_path” is the copied data about the folder location. Next, you need to reload the file: "source / etc / environment". This completes the addition of the variable.

Browser Plugin

Two commands are the way to install Java support on a browser under Ubuntu.

"Sudo update-alternatives —install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/lib/jvm/jdk1.8.0/jre/lib/i386/libnpjp2.so"

“Sudo update-alternatives —config mozilla-javaplugin.so”

How to remove Java support?

There are cases when the support of language and technology, as well as the developer package is no longer needed. To fully remove unnecessary components from the system, you can use the following commands. What tools will help with how to remove Java from Ubuntu?

You have the option to remove all versions except the one used. To do this, run the command:

"Sudo apt-get install oracle-java7-set-default "

It is also possible to remove the seventh version of the language from the system. To do this, you can use:

"Sudo apt-get remove oracle-java7-installer "

findings

If you need to install Java 8, Ubuntu offers a wide range of options for working with it. Like any system based on the Linux kernel, it allows you to fine-tune components before installing. Hopefully, this is one of those qualities of Ubunt that you also like.

If you have questions or want to discuss the topic - Welcome to the comments!