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

wild-cards are broken in the java.class.path in JDK 11

    XMLWordPrintable

Details

    • jar
    • x86_64
    • linux

    Description

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "11.0.2" 2019-01-15 and openjdk version "11.0.1" 2018-10-16

      A DESCRIPTION OF THE PROBLEM :
      I reported that the wildcard does not work for directory expansion in JDK-8220775 here is further proof below. Please look carefully at the simple example. We have tried this many times an on multiple platforms with multiple versions of Java 11. Unbelievably this appears not to work.

      mkarra@bldlinux10a testjdk]$ $JDKDIR/bin/java -cp /home/mkarra/sandboxes/testjdk/bin/linux64/bin/* lotus.domino.console.DominoController -jc -s -c

      Error: Could not find or load main class .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

      Caused by: java.lang.ClassNotFoundException: .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

      Here is the java version and another example of the problem shown above
      [mkarra@bldlinux10a testjdk]$ $JDKDIR/bin/java -version

      openjdk version "11.0.1" 2018-10-16

      OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.1+13)

      Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.11.0, JRE 11 Linux amd64-64-Bit Compressed References 20181115_18 (JIT enabled, AOT enabled)

      OpenJ9   - 090ff9dcd

      OMR      - ea548a66

      JCL      - d4455071ce based on jdk-11.0.1+13)

      [mkarra@bldlinux10a testjdk]$ $JDKDIR/bin/java -cp $NOTESBIN/* lotus.domino.console.DominoController -jc -s -c

      Error: Could not find or load main class .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

      Caused by: java.lang.ClassNotFoundException: .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

       


      We know this class is in a jar file in the directory shown

       It is documented that in Java11 wildcards should work and they simply do not work.

      REGRESSION : Last worked in version 11.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      two ways
      mkarra@bldlinux10a testjdk]$ $JDKDIR/bin/java -cp $NOTESBIN/* lotus.domino.console.DominoController -jc -s -c

      Error: Could not find or load main class .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

      Caused by: java.lang.ClassNotFoundException: .home.mkarra.sandboxes.testjdk.bin.linux64.bin.AddMembers

      OR swap a specifying a single jar in the classpath with * as shown below
      strncpy(classpath, "-Djava.class.path=", sizeof(classpath)-1);
      strcat(classpath, exedir);
          strcat(classpath, DIR_SEPARATOR);
          //strcat(classpath, CONSOLE_JAR);
      strcat(classpath, "*");
          strcat(classpath, PATH_SEPARATOR);
          strcat(classpath, DEF_CLASSPATH);
          strcat(classpath, PATH_SEPARATOR);
          strcat(classpath, exedir);
          strcat(classpath, JVM_LIB_EXT);
          strcat(classpath, DIR_SEPARATOR);
          strcat(classpath, MAIL_JAR);
          options[noptions++].optionString = classpath;

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      a class path element that contains a base name of an asterisk (*) is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR
      ACTUAL -
      a class path element that contains a base name of an asterisk (*) IS NOT equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR

      CUSTOMER SUBMITTED WORKAROUND :
      specify the specific jar file. We have too many jars to do this because of the size of the application

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              pardesha Pardeep Sharma
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: