Oracle JDK 8 is not installed

Good night, I'm having trouble installing java8 on umbuntu

I have tried to delete all apt-get that I installed, and reinstall. I'm following this tutorial https://www.digitalocean.com/community/tutorials/como-instalar-o-java-com-apt-get-no-ubuntu-16-04-pt

I got to the point of reinstalling umbuntu, and in this command

sudo apt-get install oracle-java8-installer

Gives the error below

root@henrique-Aspire-5741:~# apt-get install oracle-java8-installer 
Lendo listas de pacotes... Pronto
Construindo árvore de dependências       
Lendo informação de estado... Pronto
oracle-java8-installer is already the newest version (8u201-1~webupd8~1).
0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 3 não atualizados.
1 pacotes não totalmente instalados ou removidos.
Depois desta operação, 0 B adicionais de espaço em disco serão usados.
Você quer continuar? [S/n] 
Configurando oracle-java8-installer (8u201-1~webupd8~1) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2019-04-16 20:27:16--  http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolvendo download.oracle.com (download.oracle.com)... 23.52.118.67
Conectando-se a download.oracle.com (download.oracle.com)|23.52.118.67|:80... conectado.
A requisição HTTP foi enviada, aguardando resposta... 302 Moved Temporarily
Localização: https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz [redirecionando]
--2019-04-16 20:27:16--  https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolvendo edelivery.oracle.com (edelivery.oracle.com)... 23.2.191.58, 2600:1419:0:6a1::366, 2600:1419:0:69f::366
Conectando-se a edelivery.oracle.com (edelivery.oracle.com)|23.2.191.58|:443... conectado.
A requisição HTTP foi enviada, aguardando resposta... 302 Moved Temporarily
Localização: http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1555457357_6043b825975efc4efe4e795c46e76390 [redirecionando]
--2019-04-16 20:27:17--  http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1555457357_6043b825975efc4efe4e795c46e76390
Conectando-se a download.oracle.com (download.oracle.com)|23.52.118.67|:80... conectado.
A requisição HTTP foi enviada, aguardando resposta... 301 Moved Permanently
Localização: https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1555457357_6043b825975efc4efe4e795c46e76390 [redirecionando]
--2019-04-16 20:27:17--  https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz?AuthParam=1555457357_6043b825975efc4efe4e795c46e76390
Conectando-se a download.oracle.com (download.oracle.com)|23.52.118.67|:443... conectado.
A requisição HTTP foi enviada, aguardando resposta... 404 Not Found
2019-04-16 20:27:22 ERRO 404: Not Found.

download failed
Oracle JDK 8 is NOT installed.
dpkg: erro ao processar o pacote oracle-java8-installer (--configure):
 installed oracle-java8-installer package post-installation script subprocess returned error exit status 1
Erros foram encontrados durante o processamento de:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

A strange thing is that any apt-get I try to install from Oracle JDK 8 error is NOT installed. For example a sudo apt - get install vim

When I give a java-version

openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.10.3)
OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.10.3, mixed mode, sharing)
Author: Henrique Lemes Baron, 2019-04-16

2 answers

The most uncomplicated way to get Java (and other things related to the JVM ecosystem like Maven, Gradle, Springboot, Kotlin, Scala and etc) in a Linux distribution is by using sdkman

To install it, just type:

curl -s "https://get.sdkman.io" | bash

After installation:

source "$HOME/.sdkman/bin/sdkman-init.sh"

Done that, just install the version (8,9,10...) desired Java (Oracle, Zulu, OpenJDK, Amazon and etc). To consult the available types just type

sdk list java

insert the description of the image here

To choose the version to install, simply type:

sdk install java "versão desejada"

After installation, sdkman will ask if you want to set as Default... You put Yes[Y]. To export the JDK for use in other IDEs, I suggest creating a variable JAVA_HOME

JAVA_HOME="$HOME/.sdkman/candidates/java/current"
export JAVA_HOME

Done, just restart the shell and use as you wish:

 1
Author: Diego da Silva Pinheiro, 2020-06-11 14:45:34

Looks like the installer hasn't been updated yet. You can try downloading directly from the oracle repository, try these commands:

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u181|JAVA_VERSION=8u191|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="1845567095bfbfebd42ed0d09397939796d05456290fb20a83c476ba09f991d3"|SHA256SUM_TGZ="53c29507e2405a7ffdbba627e6d64856089b094867479edc5ede4105c1da0d65"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_181|J_DIR=jdk1.8.0_191|' oracle-java8-installer.*

Read more about at: https://ubuntuforums.org/showthread.php?t=2374686&p=13699352#post13699352

 0
Author: Paulo Victor, 2019-04-17 00:02:32