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

java -version cannot find libjava when java in bin/bin directory

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      ADDITIONAL SYSTEM INFORMATION :
      $ cat /etc/redhat-release
      CentOS release 6.10 (Final)
      $ uname -a
      Linux pnode-01.csrs 2.6.32-754.11.1.el6.x86_64 #1 SMP Tue Feb 26 15:38:56 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
      $ ./java -version
      openjdk version "11.0.2" 2019-01-15
      OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
      OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      If the path provided to the --output option ends with a directory called "bin", the resulting image is not runnable, because Java does not find the necessary dynamic libraries.
      In particular, executing java results in the following error:
      Error: could not find libjava.so
      Error: Could not find Java SE Runtime Environment.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1 - Download jdk-11.0.2, unpack it into a directory $JDK_HOME
      2 - create a modular HelloWorld application, call the module HelloModule
      3 - compile the application, put the class files in a directory $CLASSES
      4 - execute $JDK_HOME/bin/jlink --module-path $CLASSES:$JMOD --add-modules HelloModule --output bin
      5 - execute ./bin/bin/java -version
      6 - repeat step 4 using --output dist/bin
      7 - repeat step 5

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The java executable should be able to find the dynamic libraries without assuming that the full path of the java executable contains only one instance of "bin"
      ACTUAL -
      The java executable can't find the dynamic libraries if the --output path provided to jlink ends with "bin"

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use a --output path that ends with "bin"

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: