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

Class-Path attribute in jar manifest fails if target jar is a symlink

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      MacOS Mojave (10.14.6)
      Test on
          JDK1.8.0_192
          JDK 9
          JDK 10.0.2
          JDK 11.0.2
          JDK 12.0.2
          JDK 13 (build 13+33)

      A DESCRIPTION OF THE PROBLEM :
      Launching an executable jar with -jar fails when a required jar on the class-path is a symlink. However executing the same program using -cp succeeds.

      myApp.jar (contains main method)
            manifest file contains class-path variable that points to myLib.jar
      myLib.jar (must be on the class-path)

      When myLib.jar is a symlink the following error occur when launching the jar using java -jar

      Error: Unable to initialize main class ...
      (for JDK 9, JDK 10.0.2 JDK 11.0.2, JDK 12.0.2, JDK 13 (build 13+33))

      Error: A JNI error has occured, please check your installation and try again
      (for JDK1.8.0_192)

      These errors do not occur if any one of the follow holds true:
      1) The symlink is replace with the actual jar file.
          or
      2) The app is launched without -jar and using -cp to point to myLib.jar. Using -cp the JVM follows the symlink without issue.

      It would be nice if the JVM resolved class-path dependencies in jar manifest the same way it does with command line option -cp. This includes resolving 1) symlinks and 2) wildcard paths


        Attachments

          Activity

            People

            Assignee:
            tongwan Andrew Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: