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

--add-opens cannot be used in JAVA_TOOL_OPTIONS variable

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Using the --add-opens option in JAVA_TOOL_OPTIONS environment variable leads to "Unrecognized option" error. Same for other similar options like "--add-exports"

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      $ export JAVA_TOOL_OPTIONS="--add-opens java.base/java.util=ALL-UNNAMED"
      $ java -version

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Picked up JAVA_TOOL_OPTIONS: --add-opens java.base/java.util=ALL-UNNAMED
      openjdk version "17.0.3.1" 2022-04-22 LTS
      OpenJDK Runtime Environment (build 17.0.3.1+2-LTS)
      OpenJDK 64-Bit Server VM (build 17.0.3.1+2-LTS, mixed mode, sharing)

      ACTUAL -
      Picked up JAVA_TOOL_OPTIONS: --add-opens java.base/java.util=ALL-UNNAMED
      Unrecognized option: --add-opens
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.

      FREQUENCY : always


            sswsharm swati sharma (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: