0
I install Oracle java 1.8.0_101 manually on Debian 10 for hadoop uses, I have found this tutorial : https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps . I execute this after extracting the .tar file in /etc/jdk:
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_101/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_101/bin/javac 100
Then I execute this two commands and this is the result:
update-alternatives --display java
update-alternatives --display javac
java - auto mode
link best version is /opt/jdk/jdk1.8.0_101/bin/java
link currently points to /opt/jdk/jdk1.8.0_101/bin/java
link java is /usr/bin/java
/opt/jdk/jdk1.8.0_101/bin/java - priority 100
/usr/lib/jvm/jdk1.8.0_101/bin/java - priority 3
javac - auto mode
link best version is /usr/lib/jvm/jdk1.8.0_101/bin/javac
link currently points to /usr/lib/jvm/jdk1.8.0_101/bin/javac
link javac is /usr/bin/javac
/opt/jdk/jdk1.8.0_101/bin/javac - priority 100
/usr/lib/jvm/jdk1.8.0_101/bin/javac - priority 100
After doing all that, when I try java -version this is the result :
root@Debian:/opt/jdk# java -version
bash: /usr/bin/java: No such file or directory
I add java to path , and I create the java_home:
root@Debian:/opt/jdk# echo $JAVA_HOME
/opt/jdk/jdk1.8.0_101
root@Debian:/opt/jdk# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk/jdk1.8.0_101/bin:/opt/jdk/jdk1.8.0_101/db/bin:/opt/hadoop/sbin:/opt/hadoop/bin
this is the content of /etc/environement :
root@Debian:/opt/jdk# cat /etc/environment
PATH="/opt/jdk/jdk1.8.0_101:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/opt/jdk/jdk1.8.0_101"
When I execute
sudo update-alternatives --config java
I have this result :
root@Debian:/opt/jdk# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
+0 /opt/jdk/jdk1.8.0_101/bin/java 100 auto mode
1 /opt/jdk/jdk1.8.0_101/bin/java 100 manual mode
2 /usr/lib/jvm/jdk1.8.0_101/bin/java 3 manual mode
Press to keep the current choice[+], or type selection number:
the result shows that I'm using /opt/jdk/jdk1.8.0_101/bin/java I don't understand what is the origin of this problem to fix it , please any one have an idea how to fix it ?