Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6549226

-version:nn on Ubuntu doesn't find other JVM's even when installed using Ubuntu/Debian packages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 6
    • install
    • x86
    • linux

      I am on Ubuntu 6.10 and am using the Sun-JDK bundled by Ubuntu using the DLJ bundles
      released through the jdk-distros project.

      I have both 1.5.0_08 and 1.6.0 installed, both from those Sun-JDK bundles distributed
      by Ubuntu. They are installed as so:

      dherron@dherron:~$ ls /usr/lib/jvm
      java-1.5.0-sun java-1.5.0-sun-1.5.0.08 java-6-sun java-6-sun-1.6.0.00

      Supposedly the -version:nn command lets one select a different JVM even when it's
      not the one in the PATH. However this doesn't work.

      dherron@dherron:~$ java -version
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
      dherron@dherron:~$ java -version:1.5\*
      Unable to locate JRE meeting specification "1.5*"

      What I remember from when this -version:nn feature went in, we specified that on Linux
      Java would be installed to /usr/java and that the directories would be named in
      a particular way. It's most likely that Ubuntu's install location does not match
      the way we defined it would be.

      I believe this feature needs to be changed so that the packager (Ubuntu in this case)
      can tell the JVM how to figure out where alternative versions are installed.
      e.g. some kind of file or property that's read at runtime, when the -version:nn option
      is enabled, and which tells the directory containing the alternate versions of Java,
      and the directory name pattern to follow to determine the available versions.

      A complication is that .. on Ubuntu anyway .. the /usr/lib/jvm directory can contain
      JVM's provided by others besides Sun. So it's an interesting question whether Sun's
      "java" command should support launching an alternative Java implementation from another
      vendor, or whether Sun's "Java" command only hunts for alternative Java versions that
      were made by Sun.

      Another related issue is that .. on Ubuntu .. there is a command update-java-alternatives
      that lets one switch which Java implementation is used by the "java" command. Their
      command allows one to switch between Java implementations from various vendors, not just
      Sun's implementation.

      One might say, with update-java-alternatives, that one might not need to support this
      -version:nn option on Ubuntu. That may be, but a) this is a documented feature that is
      not working properly, b) what about other Linux distributions that do not have
      an equivalent to update-java-alternatives and who are packaging Sun's DLJ distro? And
      further what about Linux distributions who are compiling OpenJDK source on their own?

      On a system that lacks update-java-alternatives the user is still, sometimes, going
      to desire to use an alternative Java version and have an easy way to select the
      specific Java version. If that specific distribution is not installing Sun's Java to
      the place Sun is expecting it to be installed, then -version:nn will not work on
      those systems.

      Distributions who compile their own from the OpenJDK also are likely to want to make
      no modifications to the source. This is what we were told at the FOSDEM meeting
      by the Fedora guy who packages Java, that they want to compile from source, and their
      preference is to make zero changes to the source. But if they then want to install
      their binaries to a place other than the place we specified, then -version:nn isn't
      going to work on their system.

      The general principle is that a given operating system distribution knows what their
      preferred filesystem layout is. We do not know all the various and sundry preferred
      filesystem layouts for various operating system distributions, and nor should we. Instead
      we should be following a path of helping the operating system distributor to package
      the thing in a way that is natural to their system.

            Unassigned Unassigned
            dherronsunw David Herron (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: