After asking the question Can I indicate that a .deb package depends on Java, but not specify what implementation (e.g. OpenJDK, IcedTea, Oracle)?, I was helpfully informed that I could include a dependency of default-jre when building my package, which would automatically find an appropriate version of Java to install before installing the package.

However, when I try to do the same for a .rpm package, I instead get the following error:

Could not depsolve transaction; 1 problem detected:

  1. nothing provides default-jre needed by

How can I get default-jre to work with a .rpm package as it does with a .deb package?

To be clear, I want this to be an automatic dependency so that a user can take the .rpm package and install the app (and Java if not already installed) without needing to do anything on their own.

2 Answers 2

Requires: java

Should do almost what you need. At least on RHEL/CentOS all Java packages habe a Provides: java and that will be pulled in with the above Requires. However you will get the latest Java if none is installed, not the default one. If one is already installed the dependency is already fulfilled and nothing happens.


if you have downloaded the package to your local system then run the below

yum localinstall default-jre.rpm

reference link

  • I'm looking for a way to make this a dependency on the package so that an end user doesn't have to run a command on their own. It should be a one-step install of the .rpm. I've modified my question to clarify this. Commented Jul 2, 2016 at 6:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .