Correct way to install virtual dependency

Solution 1:

I would remove the version from your "java-runtime-headless" dependency.

Virtual packages suffer from some troubling limitations, the most significant of which being the absence of a version number.

http://debian-handbook.info/browse/stable/sect.package-meta-information.html

If you want to specify which of a set of real packages should be the default to satisfy a particular dependency on a virtual package, you should list the real package as an alternative before the virtual one.

http://sdn.vlsm.org/share/Debian-Doc/debian-policy/ch-relationships.html

Solution 2:

So, why did you aborted the execution of sudo apt-get -f install. Run it again and don't abort it.

After run these commands:

sudo apt-get clean
sudo apt-get autoclean
sudo dpkg --configure -a

Then run again:

sudo apt-get -f install

If the output is something like:

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded

then run:

sudo apt-get -u dist-upgrade

See How do I resolve unmet dependencies after adding a PPA? for more about.

Now install java-runtime-headless using the following command:

sudo apt-get install openjdk-7-jre-headless

And finally, install your application:

sudo dpkg -i MYAPP.deb 

Solution 3:

As NGRhodes suggested I changed the dependencies to

Depends: openjdk-7-jre-headless | java-runtime-headless, ...
Recommends: ...

Now I can install it with

$ sudo dpkg -i MYAPP.deb

and install the missing dependencies with

$ sudo apt-get -f install