Installing Java on Debian 10

Java is very popular programming language. These four letters are familiar to all, even the housewife who just wants to log on to your favorite Classmates, but before her face suddenly POPs up a notification about some strange Java and she has to call her son.

Seriously, the language was developed by Sun Microsystems and is commonly used for the creation and development of various programs: web and server applications, desktop applications, etc. Probably will be asked why he’s so popular?. The answer is simple — because Java is cross platform language, and it means not having to spend time to adapt a given application under different systems, but these applications need Java-machine. Now we will look how to install Java Debian 10

Java version

Like everything else in this world Java is not standing still and is constantly evolving. For example, the legendary “eight” just written most of the programs we use. In General, the new version of Java came out almost every six months, but support for those 9, 10 and 11 version was only 7 months. This was the reason that Java 8 runs most of the programs, because its support is established for a period until 2020, and that it will have to set most of your tasks.

It should be noted that the platform exists in 2 formats:

  • Open JDK — open version.
  • Oracle Java — support, extra features and other pleasures with her.

Both are authored by Oracle, but if the first community supported, the second is the company.

For Linux Java comes in two editions:

  • Java Development Kit full Java version. This revision is necessary for development.
  • Java Runtime Environment – this revision is needed for “startup” programs to work.

Figured out what you want from Java? If the developer put the JDK if you are a normal user of the JRE. Figure it out. Now let’s find out why this guide.

And the purpose of this guide is to show how to install Java on Debian 10. Generally searching on the Internet for similar guidance on this same subject I ran across lots of old and unhealthy ways. We’re not alone in the choice of their system, right?

Install Oracle Java 8 from the official website

The first problem you’ll encounter is a broken repository. But written guidance is not just so, so sit back and watch. Go to the official Java website and download the JDK.

Put a tick if we agree with the license agreement and choose this version (the one that Lunix x64 186 MB)

Oops! And how is it?!

Nothing terrible, just create an account, activate and download. Downloaded? Now let’s unpack.

Often, for example, in Debian or Ubuntu for Java versions used the /usr/lib/jvm. Now go into terminal and do the following:

sudo mkdir -p /usr/lib/jvm

cd ~/Downloads

sudo tar-xf *file name* -C /usr/lib/jvm

Great, now he unpacked. Enter the name of the file exactly like what it was downloading. In my case, it looks like this:

Installing java 8 on debian is almost complete. Now use the command to install Java.

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/*folder name*/bin/java 1

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/*folder name*/bin/javac 1

sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/*folder name*/bin/javaws 1

There is one important point. A directory path may be different, and to find it just go to Windows Explorer. Here’s an example:

And here is how it looks in terminal:

Now check which version the command:

java-version

You should appear here is on a terminal:

And you know what that means? You have installed Java version 1.8.0_221. All easy enough, but the important thing is to execute commands sequentially.

By the way, there are plenty of other mounting options, but in my opinion it is better to use this, so here:

  • You use the official source for installation;
  • You will not have problems with access repositories (and they are, believe me);

For the JRE to do everything well, except the second team to skip it and move on to the third. You better not be confused and just leave a command here. Remember, they are coming right out of the box!

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/*folder name*/bin/java 1

sudo update-alternatives --install /usr/bin/javaws /usr/lib/jvm/*folder name*/bin/javaws 1

Install Oracle Java 12 from the official website

Here it is: you can use the same method as with Java 8 with the Java website shake the version you need (in this case Java 12) and then perform the same command. But that’s boring, right? Then show you another way and he is definitely working!

To do this you need to start to add PPA repositories, but before that let’s update a bit

sudo apt update
sudo apt upgrade

Add repositories for installing on Debian 10. Do this commands in terminal

echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list

sudo apt install dirmngr

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A

Once you’ve added them, then running a new team, but already on the Java installation 12:

sudo apt update
sudo apt install oracle-java12-installer

Next you will see the following

Scroll down (it’s the EULA, no one reads) and press Ok. Now we need to check if all was installed properly. This is done with the command:

java-version

If the display again shows:

Then write another command. By the way, with its help you can see what Java versions you have are in the system but the main problem is she has another.

sudo update-alternatives --config java

I have it as follows:

Under each room is a version which you can use by default. Just select the one that is needed. For example, clicking on “3” I chose Java 12. Now when you run the command

java-version

I get this result:

Remove Java in Debian 10

Set we learned, but it would be nice to know how to remove Java Debian 10, right? To do this, too, is very simple. Write command:

sudo apt purge openjdk*

Under openjdk* mean the java version you want to delete. Remember to know what you have? Properly, it is necessary to execute the command

sudo update-alternatives --config java

And get the result with all versions that you have in the system

Now, to remove, for example, Java 11, you will need to run the command

remove openjdk sudo apt-11-jdk

And it’s the same for each version.

Insights

As you can see, no difficulty in all this process. It is only necessary to sequentially execute commands and to read the official guide. Well, that’s true, the community can always help with advice, but before you contact them, it is often better to read what is written by the developers about their product. This applies not only to Java, but in General, just in General, because you will come across completely different ways of solving tasks on a thematic forum. And not always these methods will work, but you will be wasting your time. And nerves.

Source: losst.ru

(Visited 19 times, 1 visits today)