Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-10448

Obsolete java options -d32, -d64 in jdk-10 affect scripts domain.sh, standalone.sh, appclient.sh

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Minor Minor
    • None
    • 13.0.0.Final, 16.0.0.Final
    • Scripts
    • None

      bin\scripts domain.sh, standalone.sh and appclient.sh have a section of code that uses java option -d32 and -d64 when calling java to check the HotSpot type. These 2 options have been removed from JDK-10. They are marked as deprecated in JDK-9 but still function.
      These options are used in determining if '-server' is added to JAVA_OPTS. Enhancements need to be made to the scripts to check the JDK version and take appropriate action is assigning the value '-server'.

      The code affected

      # Check for -d32/-d64 in JAVA_OPTS
      JVM_OPTVERSION="-version"
      JVM_D64_OPTION=`echo $JAVA_OPTS | $GREP "\-d64"`
      JVM_D32_OPTION=`echo $JAVA_OPTS | $GREP "\-d32"`
      test "x$JVM_D64_OPTION" != "x" && JVM_OPTVERSION="-d64 $JVM_OPTVERSION"
      test "x$JVM_D32_OPTION" != "x" && JVM_OPTVERSION="-d32 $JVM_OPTVERSION"
      
      # If -server not set in JAVA_OPTS, set it, if supported
      SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
      if [ "x$SERVER_SET" = "x" ]; then
      
          # Check for SUN(tm) JVM w/ HotSpot support
          if [ "x$HAS_HOTSPOT" = "x" ]; then
              HAS_HOTSPOT=`"$JAVA" $JVM_OPTVERSION -version 2>&1 | $GREP -i HotSpot`
          fi
      
          # Check for OpenJDK JVM w/server support
          if [ "x$HAS_OPENJDK" = "x" ]; then
              HAS_OPENJDK=`"$JAVA" $JVM_OPTVERSION 2>&1 | $GREP -i OpenJDK`
          fi
      
          # Check for IBM JVM w/server support
          if [ "x$HAS_IBM" = "x" ]; then
              HAS_IBM=`"$JAVA" $JVM_OPTVERSION 2>&1 | $GREP -i "IBM J9"`
          fi
      
          # Enable -server if we have Hotspot or OpenJDK, unless we can't
          if [ "x$HAS_HOTSPOT" != "x" -o "x$HAS_OPENJDK" != "x" -o "x$HAS_IBM" != "x" ]; then
              # MacOS does not support -server flag
              if [ "$darwin" != "true" ]; then
                  PROCESS_CONTROLLER_JAVA_OPTS="-server $PROCESS_CONTROLLER_JAVA_OPTS"
                  HOST_CONTROLLER_JAVA_OPTS="-server $HOST_CONTROLLER_JAVA_OPTS"
                  JVM_OPTVERSION="-server $JVM_OPTVERSION"
              fi
          fi
      else
          JVM_OPTVERSION="-server $JVM_OPTVERSION"
      fi
      

      Here is the output of the currently supported java versions

      Doc for jdk-8 states
      > java -help
      where options include:
      -d32 use a 32-bit data model if available
      -d64 use a 64-bit data model if available

      Using these options tell if the version supports 32-bit or 64-bit

      > java -d32 -version
      Error: This Java instance does not support a 32-bit JVM.
      Please install the desired version.

      > java -d64 -version
      java version "1.8.0_72"
      Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

      Doc for jdk-9 states
      > java -help
      where options include:
      -d32 Deprecated, will be removed in a future release
      -d64 Deprecated, will be removed in a future release

      > java -d32 -version
      Error: This Java instance does not support a 32-bit JVM.
      Please install the desired version.

      > java -d64 -version
      openjdk version "9.0.4"
      OpenJDK Runtime Environment (build 9.0.4+11)
      OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)

      Doc for jdk-10
      > java -help
      No documentation for these options listed

      > java -d32 -version
      Unrecognized option: -d32
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.

      > java -d64 -version
      Unrecognized option: -d64
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.

      Obsolete java options -d32, -d64 in jdk-10 affect scripts domain.sh, standalone.sh

              rsearls r searls
              rsearls r searls
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: