How To Install Java JDK on Debian 11 – Holhol24

0 14

[*][*]The Java JDK (Java Development Kit) is a tool construction atmosphere used for growing Java Applications. The JDK is a number of programming gear, particularly JRE (Java Runtime Environment), Java (Loader for Java Application), Javac (Compiler), Jar (Archiver), and so forth.

[*]On the opposite hand, we have now JRE (Java Runtime Environment), which contains all elements required to run techniques written within the Java programming language.

OpenJDK or Oracle Java

[*]OpenJDK is an open-source implementation of Oracle’s proprietary Java Development Kit (JDK). Oracle develops Oracle Java SE, while the OpenJDK is now evolved through Oracle Corporation, OpenJDK and Java Community, Red Hat, IBM, Azul Systems, Apple Inc, and SAP SE.

[*]There isn’t any technical distinction between OpenJDK and Oracle JDK.

Install Java on Debian 11

[*]Install OpenJDK or Oracle Java as in step with your requirement.

[*]You may have more than one variations of Java (OpenJDK and Oracle Java) for your machine. But, you’ll be able to have just one default edition.

Install OpenJDK

[*]Installing OpenJDK in Debian is a lovely easy procedure.  You can use the apt command to put in OpenJDK.

Install OpenJDK JDK

### Default Java JDK ###

sudo apt set up -y default-jdk

### Java JDK 11 ###

sudo apt set up -y openjdk-11-jdk

### Java JDK 8 ###

sudo apt set up -y openjdk-8-jdk

Install OpenJDK JRE

### Default JRE ###

sudo apt set up -y default-jre

### Java JRE 11 ###

sudo apt set up -y openjdk-11-jre

### Java JRE 8 ###

sudo apt set up -y openjdk-8-jre

Install Oracle Java

[*]There isn’t any separate JRE (Java Runtime Environment) anymore in Oracle Java. Instead, Oracle JDK now supplies JRE as smartly.

Download Oracle Java

[*]You can both use the command line or browser to obtain Oracle Java.

[*]Go to the Oracle JDK web page to obtain programs the use of the browser. Then, obtain the Debian binary package deal for simple set up.

[*]Oracle Java JDK 12:

Download Oracle Java 16 (v16.0.2)

[*]Oracle Java JDK 11 (LTS):

Download Oracle Java 11 LTS (v11.0.12) (Login Required)

[*]Oracle Java JDK 8:

Download Oracle Java 8 (v8u301) (Login Required)

[*]If you continue to need to use the command line, use the under command.

### Oracle Java JDK 16 ###

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://obtain.oracle.com/otn-pub/java/jdk/16.0.2p.c2B7/d4a915d82b4c4fbb9bde534da945d746/jdk-16.0.2_linux-x64_bin.deb

### Oracle Java JDK 11 ###

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://obtain.oracle.com/otn-pub/java/jdk/11.0.12p.c2B8/f411702ca7704a54a79ead0c2e0942a3/jdk-11.0.12_linux-x64_bin.deb

### Oracle Java JDK 8 ###

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://obtain.oracle.com/otn-pub/java/jdk/8u301-b09/d3c52aa6bfa54d3ca74e617f18309292/jdk-8u301-linux-x64.tar.gz

[*]Install / Extract the downloaded Oracle Java package deal.

### Oracle JAVA JDK 16 ###

sudo apt set up -y ./jdk-16.0.2_linux-x64_bin.deb

### Oracle JAVA JDK 11 ###

sudo apt set up -y ./jdk-11.0.12_linux-x64_bin.deb

### Oracle JAVA JDK 8 ###

sudo tar -zxvf jdk-8u301-linux-x64.tar.gz -C /usr/lib/jvm/

Install Oracle Java JDK/JRE

[*]Run update-alternatives instructions to put in Java for your machine.

### Oracle Java 16 ###

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.*/bin/java 1

### Oracle Java 11 ###

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.*/bin/java 2

### Oracle Java 8 ###

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.*/bin/java 3

Set Default Java Version

[*]Use the choices command to set the default java edition.

sudo update-alternatives --config java

[*]Select Java:

[*]If your machine has more than one Java variations, then the command would checklist all Java variations like under.

There are 4 possible choices for the opposite java (offering /usr/bin/java).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      handbook mode
  2            /usr/lib/jvm/jdk-11.0.12/bin/java             2         handbook mode
  3            /usr/lib/jvm/jdk-16.0.2/bin/java              1         handbook mode
* 4            /usr/lib/jvm/jdk1.8.0_301/bin/java            3         handbook mode

Press  to stay the present selection[*], or sort variety quantity: 1

[*]Enter the quantity under the variety column to set the default Java edition.

[*]Here, I selected 1 for OpenJDK 11.

Verify Java Version

[*]Check the java edition the use of the next command.

java -version

[*]Output:

openjdk edition "11.0.12" 2021-07-20
OpenJDK Runtime Environment (construct 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (construct 11.0.12+7-post-Debian-2, blended mode, sharing)

[*]The output would possibly range relying upon the package deal and the edition you selected to be the default Java edition.

Setup Environmental Variables

[*]Java programs frequently require JAVA atmosphere variables to be set within the machine. For instance, to run Java techniques from any place, you want to set $JAVA_HOME and different variables to check your edition of Java.

[*]Create a brand new record beneath /and so forth/profile.d listing.

sudo nano /and so forth/profile.d/java.sh

[*]Set variables in accordance with the Java location and edition for all customers.

export PATH=$PATH:/usr/lib/jvm/jdk-11.0.12/bin/
export JAVA_HOME=/usr/lib/jvm/jdk-11.0.12/

[*]To set the surroundings variables for a selected consumer, position the above variables in ~/.bash_profile record.

[*]Load the environments into the present consultation.

supply /and so forth/profile.d/java.sh

Conclusion

[*]I am hoping this publish helped you put in Java on Debian 11. Java is a should to run Tomcat, Gradle, ELK Stack, Graylog, Eclipse IDE, Hadoop, and so forth.

Leave A Reply

Your email address will not be published.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.