Installare Oracle Java 10 su Debian 9-10 via APT

Installare Oracle Java 10 su Debian 9/10 via APTInstallare Oracle Java 10 su Debian 9-10 via APT

Ci sono diversi modi per installare Oracle Java su Debian, ma quello più comodo è aggiungere i repository di Linux Uprising:

ed usare apt:

sudo apt update
sudo apt upgrade -y
sudo apt install software-properties-common
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EA8CACC073C3DB2A
sudo apt update
sudo apt install -y oracle-java10-installer
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

output:

edmond@debianbox:~$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/local/oracle-java-8/jdk1.8.0_191/bin/java 1500 auto mode
* 1 /usr/lib/jvm/java-10-oracle/bin/java 1091 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
3 /usr/local/oracle-java-8/jdk1.8.0_191/bin/java 1500 manual mode

Press <enter> to keep the current choice[*], or type selection number:

Installare Oracle Java 10 su Debian 9-10 via APT

enjoy 😉

Installare Oracle Java 8 su Debian Jessie/Strech

 

Installare Oracle Java 8 su Debian Jessie/Strech

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 mode

Press 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 😉