3

I've tried to install java with

# add-apt-repository -y ppa:webupd8team/java
# apt update
# apt install oracle-java8-installer

but got error:

ERROR 404: Not Found.

download failed
**Oracle JDK 8 is NOT installed.

I've search internet and found solution:

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u201|JAVA_VERSION=8u211|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/|PARTNER_URL=https://download.oracle.com/otn/java/jdk/8u211-b12/478a62b7d4e34b78b671c754eaaf38ab/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="cb700cc0ac3ddc728a567c350881ce7e25118eaf7ca97ca9705d4580c506e370"|SHA256SUM_TGZ="c0b7e45330c3f79750c89de6ee0d949ed4af946849592154874d22abc9c4668d"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_201|J_DIR=jdk1.8.0_211|' oracle-java8-installer.*

But now i have another error:

Resolving login.oracle.com (login.oracle.com)... 156.151.58.18
Connecting to login.oracle.com (login.oracle.com)|156.151.58.18|:443... connected.
HTTP request sent, awaiting response... 401 Authorization Required

Username/Password Authentication Failed.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 installed oracle-java8-installer package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

What is this 401 authorization? I should enter credentials anywhere? Please help!

  • You may download jdk-8u212-linux-x64.tar.gz (185.98 MB) directly from oracle.com/technetwork/java/javase/downloads/… and install it at /opt/jvm or any where you wish. – Marmayogi Apr 18 '19 at 16:10
  • 1
    When you download from oracle website, you need credentials. If you don't pass correct string during download, you will get 401 authorization error. From /var/lib/dpkg/info, the URL that contains string 42970487e3af4f5aa5bca3f542482c60 which may be incorrect. – Marmayogi Apr 18 '19 at 16:19
  • 1
    This PPA has been discontinued. Better not to use this PPA anymore. Reference. – Kulfy Apr 19 '19 at 8:50
  • Kulfy, That mean we should use another repositories for autoinstallation or install Java JDK manually? BTW I've installed 8u211 manually, but that was a bit complicated. And sudo dpkg --list | grep -i jdk doesnt show it. Not sure this is ok. – Дмитрий Стародубцев Apr 19 '19 at 9:30
  • 1
    Oracle made it hard to use PPA, so I'll suggest install manually. Moreover since Oracle JDK isn't a Debian package but simply a folder containing necessary files which is used by updating alternatives, therefore it would not be there in dpkg list. Also dpkg command won't help you in updating/removing JDK. You have to replace/delete folder or update alternatives. – Kulfy Apr 19 '19 at 14:41
1

Azul manages and provides for free very functional packages of OpenJDK, from 7 to 12. As per their instructions, to install one or more java version you just need to do:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
sudo apt-install zulu-8

to have a fully functional java 8 environment. If you want to have more than one java versions installed you can choose the default one as usually done in debian/ubuntu:

update-java-alternatives -l                # to list available ones
update-java-alternatives -s zulu-8-amd64   # to set java8 as default
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.