Debian – How to install Oracle Java on Debian Wheezy with make-jpkg and fakeroot without errors

debiandebian-wheezyjavapackaging

How to install Oracle Java on Debian Wheezy with make-jpkg and fakeroot?

the manual for installing oracle java on debian wheezy is quite clear and understandable:

http://wiki.debian.org/JavaPackage
https://blogs.oracle.com/marigan/entry/installation_of_the_jdk_on
http://www.debian-administration.org/articles/142

  • download jdk-7u21-linux-x64.tar.gz from oracle
  • install the java-package
  • run make-jpkg with jdk-7u21-linux-x64.tar.gz

as root running:

make-jpkg jdk-7u21-linux-x64.tar.gz
fakeroot make-jpkg jdk-7u21-linux-x64.tar.gz

results in the following error:

You are real root — unfortunately, some Java distributions have
install scripts that directly manipulate /etc, and may cause some
inconsistencies on your system. Instead, you should become a non-root
user and run:

fakeroot make-jpkg jdk-7u21-linux-x64.tar.gz

which will allow no damage to be done to your system files and still
permit the Java distribution to successfully extract.

Aborting.

as normal user running:

make-jpkg jdk-7u21-linux-x64.tar.gz
fakeroot make-jpkg jdk-7u21-linux-x64.tar.gz

results both in an warning/error wall.

some of the errors:

dpkg-shlibdeps: warning: Can't extract name and version from library name `libverify.so'
error: couldn't find library libxslt.so.1 needed by /tmp/make-jpkg.MxvYKHyE3L/install/usr/lib/jvm/j2sdk1.7-oracle/jre/lib/amd64/libjfxwebkit.so (ELF format: 'elf64-x86-64'; RPATH: '')
dpkg-gencontrol: warning: Depends field of package oracle-j2sdk1.7: unknown substitution variable ${shlibs:Depends}
dpkg-shlibdeps: error: cannot continue due to the errors listed above

full output:
without fakeroot
http://pastie.org/private/r2llqa2pubqzh8krhbymw

with fakeroot
http://pastie.org/private/kigrgcsam9pvdazbex1fa

installing works fine:

dpkg -i oracle-j2sdk1.7_1.7.0+update21_amd64.deb

java version:

java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

are the error safe to ignore?

Best Answer

First of all, you can ignore the warnings emitted by dpkg-shlibdeps. The errors should hint you towards which packages you need to install in order to satisfy all library dependencies for the JDK.

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.

In your case, the whole JDK was already compiled by Oracle and make-jpkg only mimics the process of building a package from source. Therefore you are not required to install all the required libraries beforehand.

To silence the errors you can use apt-file to find out which packages contain the missing files (libgtk-x11-2.0.so.0, libgdk-x11-2.0.so.0, libatk-1.0.so.0, ...) and install them all.

Or you could just use OpenJDK which comes prepackaged for Debian Wheezy and can easily be installed through apt-get install openjdk-7-jdk.