Red Hat Bugzilla – Bug 1319086
libguestfs-java: mismatch class version vs java dependency
Last modified: 2017-03-21 04:55:52 EDT
Description of problem: Jar archive /usr/share/java/libguestfs-1.20.11.jar contains classes, which are version '51' (java 7). However package has set runtime requires as 'java >= 1.5.0' If for whatever reason java 1.6.0 or less was installed, no class from the jar could be run because it is not compatible. Version-Release number of selected component (if applicable): libguestfs-java-1.20.11-14.el6 How reproducible: always Steps to Reproduce: 1. jar xf /usr/share/java/libguestfs-1.20.11.jar 2. find . -name '*class' -exec file {} \; 3. rpm -qR libguestfs-java Actual results: compiled Java class data, version 51.0 (Java 1.7) java >= 1.5.0 Expected results: java requirement always satisfies compiled java class version Additional info: BuildRequires list java-1.7.0-openjdk-devel, so it seems that only requires are too old.
I was looking at this bug in general. Ideally, since we don't use any new Java features at all, we would want to compile everything with something like: -source 1.5 -target 1.5 to make our class files work even on old versions of Java. However it seems like this is not really possible without having the older Java runtime installed during compilation and/or knowing a magic classpath (http://stackoverflow.com/a/11364910). So the alternate fix is simply to fix the runtime Requires to reflect the same version of Java that we were built against. Unfortunately I don't see any RPM macro which would let us write a general rule, so we'll have to hard-code it.
Package version: libguestfs-java-1.20.11-19.el6.x86_64 Verify steps: 1. jar xf /usr/share/java/libguestfs-1.20.11.jar 2. find . -name '*class' -exec file {} \; 3. rpm -qR libguestfs-java Result: [root@dhcp-13-199 ~]# rpm -qR libguestfs-java libguestfs = 1:1.20.11-19.el6 java >= 1.7.0 So verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2017-0564.html