web-dev-qa-db-ja.com

Ubuntu 18.04 LTSにJREとJDKをインストールできません

JREとJDKの両方をインストールできません。まず第一に、私はJDKをインストールしようとしませんでしたが、JREをインストールする必要があるため、インストールしても動作しないと思います。

第二に、JREをインストールできません。 https://www.lifewire.com/install-Java-on-ubuntu-4125508 、およびJavaおよびjavacコマンドは機能しません。 Command 'Java' not found, but can be installed with: ...と書かれており、openjdkとは何なのかわかりません。私を助けてください。

追伸また、Ubuntuの質問も検索しましたが、助けにはなりませんでした。

P.P.S.ログは次のとおりです。

$ 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)

編集/P.S。これが重複していると思う人には、あなたは間違っています。私は仮想マシンを使用していません。成功するまでもう一度試してみました。私の問題は、JDKがインストールされなかったことです。 NetBeansをインストールし、JDKはインストールしなかったが、JREはインストールしたときに、これを見つけました。

1
icebunny08

JDKにはJREが含まれているため、両方に必要なのはJDKのみです。

端末セッションは、Oracle Java 8 JDKインストーラーのダウンロードが破損したことを示しています(sha256sum mismatch jdk-8u171-linux-x64.tar.gz)。問題を修正して再インストールするには:

Sudo rm /var/cache/Oracle-jdk8-installer/*.tar.gz
Sudo apt-get update
Sudo apt-get install --reinstall Oracle-Java8-installer
2
Chai T. Rex

Jdkをインストールする場合、jreをインストールする必要はありません。

ただやるとどうなる

Sudo apt-get install default-jdk

1
rkeating