Skip "update-alternatives" if a JDK is already installed

Bug #1223623 reported by cowwoc
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)

Bug Description

I have a headless automated-build server. The server executes a script which depends on Apache Ant. The "ant" package depends on "openjdk-6-jre-headless" which invokes "update-alternatives" as part of the installation process clobbering my existing Oracle JDK installation.

This is an automated build server. I cannot be expected to manually restore "update-alternatives" every time someone needs a new dependency. As such, I expect the build script not to clobber the symbolic links in the first place.

Please avoid invoking "update-alternatives" if /usr/bin/java or /etc/alternatives/java are already set. When a user installs "openjdk-6-jre-headless" it does not necessarily mean they want it to replace the default JDK. It's one thing to set yourself as the default if no JDK exists, it's another thing to clobber existing values. If the user wants to change the default, they can always do so after the installation concludes. The contrary (restoring the default JDK) is not necessarily true.

In my case, the build machine has sudo access to "apt-get" but not to "update-alternatives" because it is not meant to touch system defaults. As such, it has no way of restoring the default JDK if it gets clobbered.

Alternatively, please provide a mechanism for installing "openjdk-6-jre-headless" without running "update-alternatives" in a way that will allow me to run "apt-get install ant" at a later time without it asking to install "openjdk-6-jre-headless" a second time.

Final point: if you disagree, please do not close this issue immediately. Present your points and give me an opportunity to respond.

Thank you.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: openjdk-6-jre-headless 6b27-1.12.6-1ubuntu0.12.04.2
ProcVersionSignature: Ubuntu 3.8.0-29.42~precise1-generic
Uname: Linux 3.8.0-29-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.4
Architecture: amd64
Date: Tue Sep 10 18:08:48 2013
InstallationMedia: Ubuntu 12.04.3 LTS "Precise Pangolin" - Release amd64 (20130820.1)
MarkForUpload: True
 PATH=(custom, no user)
SourcePackage: openjdk-6
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
cowwoc (gili) wrote :
Revision history for this message
cowwoc (gili) wrote :

Nevermind, this is not a bug. It was caused by my misunderstanding of how update-alternatives works. If anyone else runs into this problem, please see for a solution.

(You can close this bug, sorry for the false alarm)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.