I have Oracle Java 7 on my Debian.

I want to install tomcat server using aptitude, but it keeps trying to install icedtea, and unnecessary java related packages. Is it possible for aptitude to know that I already have Java?

NB: I used make-jpkg command to install Java from archive.

  • 1
    Look into the equivs package, that may help. – wurtel Oct 15 '14 at 11:21
  • make-jpkg should already do that, at least if you installed the resulting .debs. Sounds like a bug somewhere... which packages are you seeing that are requiring openjdk? – derobert Oct 15 '14 at 17:54
  • @derobert Yes it was with java, and it's when I try to install tomcat7 – PeterFour Oct 15 '14 at 22:16

Edit: an easier method is here at the top, but the stuff about control files from the full original answer is still relevant, so I am keeping it below the horizontal rule.

If make-jpkg already made an Oracle Java .deb file, you could extract it, modify its control file like below to add provides directives, re-pack it, and install the modified deb..

Original answer:

Using equivs, one can create a dummy package which basically acts to make dpkg think something is installed.

A good example of how to start using 'equivs' is written here.

Officially you should start with equivs-control <:pkgname> which will create a file pkgname in the current directory. Inside are various fields but you only need eight and can simply delete the rest. Here's approximately what you should end up with for a fictional package pkgname:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: pkgname
Version: 1:42
Maintainer: Your Name <your@email.address>
Architecture: all
Description: fake pkgname to block a dumb dependency

To do this for Oracle Java, and make it act as a substitute for openjdk (which it appears is a dependency of icedtea-netx in sid, which I use), I think you need to set the provides: entry in the dpkg configuration. So your control file would look something like:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: oracle-java
Version: 7u181-2.6.14-1
Maintainer: Joe Bob <your@email.address>
Architecture: all
Description: dummy Java package to let the system know Oracle JDK is OK to use
Provides: openjdk-7-jdk, openjdk-7-jre, openjdk-7-jre-headless

Note the addition of the last line. If I could do colored text in markdown, I'd color it red for emphasis.

Then, according to the blog post linked above:

Having done this, all you need do is issue the command equivs-build path-to-pkgname (preferably from the same directory) and you get a fake deb to install with dpkg -i. Say goodbye to the dependency.

For details on the provides directive, see: https://www.debian.org/doc/debian-policy/ch-relationships.html#virtual-packages-provides

Note that I'm not sure which version of debian you're using, so I don't know if OpenJDK 7, 8, or something else is dependent on icedtea. You should probably install IcedTea at the very least, since I don't think Oracle's JDK has a web plugin. But if you wanted, and you were certain it wouldn't break anything, you could add icedtea as 'provided', too. The package name is (I think - it depends on your Debian release) icedtea-7-plugin.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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