1

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.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
PeterFour
  • 403

1 Answers1

0

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.

Wyatt Ward
  • 4,032