install java runtime edition(jre) or java standart edition(java se) on debian
install java sdk or java runtime. Its so easy.
Java SE jdk.
- Go to https://www.oracle.com/java/technologies/javase-downloads.html. And then download latest release LTE. For this time its 11.0.9. You need Oracle account for this. We download tar.gz archive with binaries. Why? Because this instruction will be work on all linux distributives.
- Unarchive archive. For example to /src or /home/src
tar zxvf jdk-11.0.9_linux-x64_bin.tar.gz
3. check java version:
java -version
For me its 🙂 :
bash: java: command not found
4. Create folder for jdk archive. I’m choose /opt/java
sudo mkdir -p /opt/java ; cd /opt/java sudo mv /src/jdk-11.0.9 /opt/java cd jdk-11.0.9
5. Install java development kit
sudo update-alternatives install /usr/bin/java java /opt/java/jdk-11.0.9/bin/java 100 sudo update-alternatives --config java
and choose version 11.0.9
update-alternatives --install /usr/bin/jar jar /opt/java/jdk11.0.9/bin/jar 100 update-alternatives --config jar update-alternatives --install /usr/bin/javac javac /opt/java/jdk11.0.9/bin/javac 100 update-alternatives --config javac
6.Check version java:
java -version java version "11.0.9" 2020-10-20 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)
7. export PATH to /etc/profile
export JAVA_HOME=/opt/java/jdk11.0.9 export JRE_HOME=/opt/java/jdk11.0.9/jre export PATH=$PATH:/opt/java/jdk11.0.9:/opt/java/jdk11.0.9/jre/bin
Install JRE
- Download latest JRE version. Now its 1.8.0.271
- move and unarchive
tar zxvf jre-8u271-linux-x64.tar.gz mv /src/jre1.8.0_271 /opt/java
- install java
sudo update-alternatives --install /usr/bin/java java /opt/java/jre1.8.0_271/bin/java 102 sudo update-alternatives --config java sudo update-alternatives --install /usr/bin/javaws java /opt/java/jre1.8.0_271/bin/javaws 102 sudo update-alternatives --config javaws
4. check java – version
java -version java version "1.8.0_271" Java(TM) SE Runtime Environment (build 1.8.0_271-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)