Je ne parviens pas à installer JRE et JDK sur mon Ubuntu 18.04 LTS

1

Je ne peux pas installer à la fois le JRE et le JDK. Tout d'abord, je n'ai pas essayé d'installer le JDK, mais je suppose que si je le faisais, cela ne fonctionnerait pas car vous devez installer le JRE.

Deuxièmement, je ne peux pas installer JRE, j'ai suivi de nombreux tutoriels tels que https://www.lifewire.com/install-java-on-ubuntu-4125508 , et les commandes javaet javacne fonctionnent pas. Ça dit, Command 'java' not found, but can be installed with: ...et je ne suis pas sûr de ce que openjdkc'est. Aidez-moi, s'il vous plaît.

Post-scriptum J'ai également cherché questions Ask Ubuntu, mais aucun d'entre eux n'a aidé.

PPS Voici le journal:

$ sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
oracle-java8-installer is already the newest version (8u171-1~webupd8~0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java8-installer (8u171-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2018-05-22 05:12:57--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.41.237.84
Connecting to download.oracle.com (download.oracle.com)|23.41.237.84|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz [following]
--2018-05-22 05:12:58--  https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 184.87.246.212, 2001:fe0:10:181::2d3e, 2001:fe0:10:195::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|184.87.246.212|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1526937299_29e0412d050d20aa9005e20d76719ea0 [following]
--2018-05-22 05:12:59--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1526937299_29e0412d050d20aa9005e20d76719ea0
Connecting to download.oracle.com (download.oracle.com)|23.41.237.84|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u171-linux-x64.tar.gz
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)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
oracle-java8-installer is already the newest version (8u171-1~webupd8~0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java8-installer (8u171-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2018-05-22 05:12:57--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.41.237.84
Connecting to download.oracle.com (download.oracle.com)|23.41.237.84|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz [following]
--2018-05-22 05:12:58--  https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 184.87.246.212, 2001:fe0:10:181::2d3e, 2001:fe0:10:195::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|184.87.246.212|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1526937299_29e0412d050d20aa9005e20d76719ea0 [following]
--2018-05-22 05:12:59--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1526937299_29e0412d050d20aa9005e20d76719ea0
Connecting to download.oracle.com (download.oracle.com)|23.41.237.84|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u171-linux-x64.tar.gz
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)

edit / PS À ceux qui pensent que c'est un doublon, vous vous trompez. Je n'utilise pas de machine virtuelle, j'ai essayé et essayé encore jusqu'à ce qu'elle réussisse, et elle l'a fait. Mon problème est que le JDK n’a pas été installé. Je l'ai découvert lors de l'installation de NetBeans et aucun JDK n'était installé, mais le JRE était installé.

icebunny08
la source
1
Double possible de Impossible d'installer JDK 9 via apt
LFC

Réponses:

2

JDK inclut JRE avec, vous n'avez donc besoin que de JDK pour les deux.

Votre session de terminal indique que le téléchargement du programme d’installation du programme d’installation Oracle Java 8 JDK était corrompu ( sha256sum mismatch jdk-8u171-linux-x64.tar.gz). Pour résoudre le problème et installer à nouveau:

sudo rm /var/cache/oracle-jdk8-installer/*.tar.gz
sudo apt-get update
sudo apt-get install --reinstall oracle-java8-installer
Chai T. Rex
la source
1

Si vous installez jdk, vous n'avez pas besoin d'installer jre.

Qu'est-ce qui se passe si vous faites juste

sudo apt-get install default-jdk

repas
la source
KISS, j'aime l'approche! +1
Le personnel d'EODCraft