Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I recently set up a build server that requires a JDK to run (for example, to compile the Java sources). The OpenJDK package in Ubuntu pulls in the OpenJDK JRE as a dependency which, in turn, depends on a large number of packages that are only relevant for graphical environments. For the standard JRE, there's a headless version of the package, but for the JDK, no.

This issue has been discussed in various places before, and one solution that I found and used was this:

$ apt-get --no-install-recommends -d install openjdk-6-jdk
$ dpkg -i --ignore-depends=openjdk-6-jre /path/to/just-downloaded.deb

While this worked, it now leaves my system with a broken dependency tree and apt-get refuses further installs untill I run apt-get -f.

Is there a better solution to this?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

This has been discussed in the following ubuntu bug.

As far as I can see you have the following options:

  1. Use the non-free Java JDK from Sun. (You can use the JavaPackage program from debian/ubuntu to create a deb pacakge of the non-free java JDK).
  2. Work with ubuntu developers to solve this issue.
  3. Create your own OpenJDK-headless package.

Of course, option 2 is the best in the long term, as it solves the problem for everyone, and options 1 and 3 solve it only for you, however 1 and 3 are quicker.

share|improve this answer
That bug thread does not look very promising to me. It seems there are some side effects to be tackled and the maintainer seems not too eager about solving the problem. I'll probably be selfish and go for the Sun JDK. – Hanno Fietz Jul 28 '09 at 14:51

Couldn't you just download and install Sun's JDK? No compiling, no X11 required. I prefer it to the packaged options.

chmod +x ~/jdk-6u14-linux-i586.bin
cd /usr
sudo mkdir java
cd java
sudo ~/jdk-6u14-linux-i586.bin
export JAVA_HOME=/usr/java/jdk1.6.0_14
export PATH=$JAVA_HOME/bin:$PATH
share|improve this answer

I suspect he just needed to update his etc-alternatives links:

update-alternatives --set java /usr/lib/jvm/default-java/bin/java

(or something like that)

share|improve this answer

What is the problem with the graphical packages? Don't you have enough space on the storage? Install the requried packages and be happy.

share|improve this answer
That is obviously an option, of course. If I must, I will. To find out if I do, I ask. These dependencies are probably more packages than I ever will install on the whole server, and I don't need a single one of them. They all want to be updated, they all go into my system images, they have config files, in short, they just add noise to my system and incur a maintenance tax for nothing. – Hanno Fietz Jul 28 '09 at 14:46
@hanno-fietz Not just noise, but potentially attack surface. One of the installed but unused packages could have a security hole that can be exploited. – CoverosGene Nov 14 '13 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.