4

I'm trying to install JDK8 on Debian Stretch. The recommended way is to use JavaPackage.

I have successfully packaged JDK6 and JDK7 using this method:

  • Download the JDK archive from Oracle
  • fakeroot make-jpkg jdk-7u55-linux-x64.tar.gz
  • dpkg -i the-resulting.deb

I can successfully create a .deb from the JDK8 archive, but when I install it with dpkg I'm missing a lot of dependencies.

gnome-icon-theme gtk-update-icon-cache java-common libasound2 libasound2-data libatk1.0-0 libatk1.0-data libcroco3 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libgail-common libgail18 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libllvm3.9 libpciaccess0 librsvg2-2 librsvg2-common libtxc-dxtn-s2tc libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1 libxrandr2 libxshmfence1 libxtst6 libxxf86vm1 x11-common

I can install them manually but I'm not sure why I didn't have this dependency problem with the earlier JDKs. I'm writing an install script and it would please me to only install a single .deb rather than having to install all the extra dependencies separately.

make-jpkg supports JDK8 according to its man page.

   make-jpkg builds a Debian package from the given Java distribution FILE.
   Supported java binary distributions currently include:
     * Oracle (http://www.oracle.com/technetwork/java/javase/downloads) :
       - The Java Development Kit (JDK), version 6, 7 and 8
       - The Java Runtime Environment (JRE), version 6, 7 and 8
       - The Java API Javadoc, version 6, 7 and 8
     (Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!)

Can anyone provide some insight as to why the .deb's created from earlier JDKs don't require any extra dependencies. Or perhaps it's just a case of their dependencies already existing in a stock Debian install.

Edit: I found this thread at Server Fault which goes some way to explaining it:

The reason this happens is that you are building a deb package from a binary distribution, i.e. a precompiled JDK. Usually, Debian packages are built from source, not from binaries. In order to do so, the person building the package would add all libraries the source depends on to a certain file (debian/control). Without those libraries installed, the source cannot be compiled and therefore would not result in a package.

Matt
  • 3,677
  • 1
  • 14
  • 24
  • 1
    I just use [webupd8](http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html). – Elliott Frisch Mar 07 '18 at 02:47
  • @ElliottFrisch thanks, I'm aware of that option but I was hoping to get the .deb procedure working for consistency with the project I'm working on. – Matt Mar 07 '18 at 04:46

1 Answers1

0

1st step as normal user

$ make-jpkg jre-8u361-linux-x64.tar.gz

2nd step as root

# dpkg -i  oracle-java8-jre_8u361_amd64.deb

Then You will get an output with errors:

Seleccionando el paquete oracle-java8-jre previamente no seleccionado.
(Leyendo la base de datos ... 184185 ficheros o directorios instalados actualmente.)
Preparando para desempaquetar oracle-java8-jre_8u271_amd64.deb ...
Desempaquetando oracle-java8-jre (8u271) ...
dpkg: problemas de dependencias impiden la configuración de oracle-java8-jre:
 oracle-java8-jre depende de java-common; sin embargo:
  El paquete `java-common' no está instalado.

dpkg: error al procesar el paquete oracle-java8-jre (--install):
 problemas de dependencias - se deja sin configurar
Se encontraron errores al procesar:
 oracle-java8-jre

3rd Step install all fix broken packages:

apt-get --fix-broken install
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
Corrigiendo dependencias... Listo
Se instalarán los siguientes paquetes adicionales:
  java-common
Paquetes sugeridos:
  default-jre
Se instalarán los siguientes paquetes NUEVOS:
  java-common
0 actualizados, 1 nuevos se instalarán, 0 para eliminar y 117 no actualizados.
1 no instalados del todo o eliminados.
Se necesita descargar 14.5 kB de archivos.
Se utilizarán 37.9 kB de espacio de disco adicional después de esta operación.
¿Desea continuar? [S/n] s
TylerH
  • 20,799
  • 66
  • 75
  • 101