Installare Oracle Java 8 su Debian Jessie/Strech. Di default su Debian Jessie viene installato OpenJDK Runtime Environment (IcedTea 2.6.6). Infatti il comando java -version, restituisce:
edmond@debianbox:~$ java -version
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-2~deb8u1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
per installare Oracle Java 8, si puo andare direttamente sul sito ed accettare la licenza, oppure:
$ sudo mkdir /opt/jdk
$ cd /opt/jdk
$ sudo wget --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.tar.gz
$ sudo tar -zxf jdk-8u92-linux-x64.tar.gz
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_92/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_92/bin/javac 100
$ sudo update-alternatives --config java
e scegliere la voce 1:
edmond@debianbox:/opt/jdk$ sudo update-alternatives –config java
There are 2 choices for the alternative java (providing /usr/bin/java).Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /opt/jdk/jdk1.8.0_92/bin/java 100 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual modePress enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /opt/jdk/jdk1.8.0_92/bin/java to provide /usr/bin/java (java) in manual mode
controllare la versione di java e javac:
$ java -version
edmond@debianbox:/$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
edmond@debianbox:/$ javac -version
javac 1.8.0_92
enjoy 😉