How to stop apt-get from installing OpenJDK?

Rashkae ubuntu at tigershaunt.com
Mon Oct 22 22:21:08 UTC 2012


On 10/22/2012 05:46 PM, jeremy p wrote:
> Hey all,
>
> At my job, we all have to use Oracle Java 1.7.  So I went ahead and
> uninstalled OpenJDK and manually installed Oracle Java 1.7.  Everything
> works great -- the only problem is that apt-get keeps wanting to install
> OpenJDK 1.6.  For example, when I tried to use apt-get to install
> apache-ant and apache-maven, both times it wanted to uninstall a bunch
> of my Java libs and install OpenJDK 1.6.  How can I stop apt-get from
> doing this?
>
> Thank you!
>
> --Jeremy
>

Note: non of this is tested by me, so I'm just replying 'in theory.'

The best way is probably to uninstall your manual Java install and 
install java with a package.  That way, the package manager will know 
that the java dependency is satisfied.  (Otherwise, you would have to 
permanently exclude the openjdk package and force the install of any 
other package that would otherwise require it.  Doesn't sound like a 
healthy long term thing to do to package dependency database.

Instructions here: should be the same for Ubuntu.

http://wiki.debian.org/JavaPackage

It shouldn't matter if OpenJDK gets installed, so long as the Debian 
alternatives points to the version of JAVA you want your applications to 
use.

The Ubuntu Java documentation shows you how to do this, under "Manual 
Method." and "Choosing the default Java to use" headings.

https://help.ubuntu.com/community/Java










More information about the ubuntu-users mailing list