No se puede instalar jdk8 en ubuntu 17.10

No se puede instalar jdk8 en ubuntu 17.10

Utilicé el siguiente código para instalar jdk 8 y agregar el repositorio

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update

Después de esto, cuando intento instalar Java usando el siguiente comando,

sudo apt-get install oracle-java8-installer

Recibo un mensaje, la respuesta del código es:

Reading package lists... Done
Building dependency tree      
Reading state information... Done
oracle-java8-installer is already the newest version (8u151-1~webupd8~0).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.

Respuesta1

oracle-java8-installer ya es la versión más nueva

Ese es el mensaje de error que recibe cuando intenta instalar el mismo paquete dos veces porque el paquete ya está instalado. Para probarlo, ejecute el siguiente comando para mostrar si oracle-java8-installer está instalado:

apt policy oracle-java8-installer  

Cuando intentó instalar Oracle-java8-installer, recibió el siguiente mensaje de error:

Descarga realizada.
Eliminando descargas obsoletas en caché...
sha256sum no coincide con jdk-8u151-linux-x64.tar.gz
Oracle JDK 8 NO está instalado.
dpkg: error al procesar el paquete oracle-java8-installer (--configure):
El script posterior a la instalación instalado por el subproceso devolvió el estado de salida de error 1
Se encontraron errores durante el procesamiento: oracle-java8-installer
E: El subproceso /usr/bin/dpkg devolvió un código de error (1)

apt dice que oracle-java8-installer está instalado pero java -versionno puede encontrar Java, por lo que no debe haberse instalado correctamente debido al sha256sum mismatcherror, lo que significa que Oracle no descargó correctamente jdk-8u151-linux-x64.tar.gz. -script del instalador java8.

Es posible que tenga el mismo problema que otros: el script oracle-java8-installer no funciona correctamente:Cuando intento instalar o eliminar cualquier software, se produce un error. Por favor, ¿alguien me puede ayudar?así que visita al oficialSitio web de Oracle Java 9, descargue jdk-9.0.1_linux-x64_bin.tar.gz desde allí e instálelo siguiendo las instrucciones de esta respuesta:¿Cómo puedo instalar Java JDK 6/7/8 o JRE patentado por Sun/Oracle?.

Respuesta2

Otra forma de confirmar que está instalado es ejecutando este comando desde tu terminal:

 dpkg-query -l oracle-java8-installer

Deberías ver esto:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
+++-==================================-======================-======================-=========================================================================
ii  oracle-java8-installer             8u151-1~webupd8~0      all                    Oracle Java(TM) Development Kit (JDK) 8

El segundo isignifica que está instalado.

De man dpkg-query:

-l, --list [package-name-pattern...]
              List  packages  matching  given  pattern.  If  no package-name-pattern is given, list all packages in /var/lib/dpkg/status, excluding the ones
              marked as not-installed (i.e. those which have been previously purged). Normal shell wildcard characters are allowed in  package-name-pattern.
              Please  note  you  will  probably have to quote package-name-pattern to prevent the shell from performing filename expansion. For example this
              will list all package names starting with “libc6”:

                dpkg-query -l 'libc6*'

              The first three columns of the output show the desired action, the package status, and errors, in that order.

              Desired action:
                u = Unknown
                i = Install
                h = Hold
                r = Remove
                p = Purge

              Package status:
                n = Not-installed
                c = Config-files
                H = Half-installed
                U = Unpacked
                F = Half-configured
                W = Triggers-awaiting
                t = Triggers-pending
                i = Installed

              Error flags:
                <empty> = (none)
                R = Reinst-required

              An uppercase status or error letter indicates the package is likely to cause severe problems. Please refer to dpkg(1)  for  information  about
              the above states and flags.

              The  output  format  of this option is not configurable, but varies automatically to fit the terminal width. It is intended for human readers,
              and is not easily machine-readable. See -W (--show) and --showformat for a way to configure the output format.

información relacionada