简体   繁体   中英

How to install java on debian virtual machine

I am trying to install Java 11 on GCP Debian 9 strech VM using PPA repositories/

I followed the steps, but after sudo apt install oracle-java11-installer I get error code saying package oracle java11- installer has no installation candidate. I even tried java11-installer-local, but it is also not working.

Step 1 : sudo apt install dirmngr

Step 2 :

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EA8CACC073C3DB2A

Add the following PPA to your Debian system. This PPA contains a package oracle-java11-installer having the Java installation script :-

Step 3 : echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list

Step 4 : sudo apt update

Step 5 : sudo apt install oracle-java11-installer

Step 6 : sudo apt install oracle-java11-set-default

Verify Java Version

Step 7 : java -version

it keeps giving the error E: Package 'oracle-java11-installer' has no installation candidate

Have you try this one

$sudo apt update
$sudo apt install default-jdk

$java -version

$echo 'deb http://ftp.debian.org/debian stretch-backports main' | sudo tee /etc/apt/sources.list.d/stretch-backports.list

$sudo apt update
$sudo apt install openjdk-11-jdk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM