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

JavaAppLauncher doesn't pass multiple JVM options with the same key

    XMLWordPrintable

Details

    • x86_64
    • generic

    Description

      ADDITIONAL SYSTEM INFORMATION :
      java version "10.0.2" 2018-07-17
      Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
      Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      `javapackager -deploy` sets multiple JVM options with the same key correctly, but the deployed launcher doesn't pass the options to the JVM correctly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac Main.java
      javapackager -createjar -appclass Main -srcdir . -srcfiles Main.class -outdir jar -outfile example
      javapackager -deploy -native image -outdir package -outfile example -appclass Main -srcdir jar -BjvmOptions=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED -BjvmOptions=--add-opens=java.base/java.io=ALL-UNNAMED
      Run package\Main\Main.exe

      `javapackager -deploy` sets the two --add-opens options to package/Main/app/Main.cfg as expected.
      [JVMOptions]
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
      --add-opens=java.base/java.io=ALL-UNNAMED

      But the Main.exe passes two same options to the JVM.
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED

      I confirmed this using VisualVM.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Main.exe passes two different --add-opens options to the JVM.
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
      --add-opens=java.base/java.io=ALL-UNNAMED
      ACTUAL -
      The Main.exe passes two same --add-opens options to the JVM.
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
      --add-opens=java.base/sun.nio.ch=ALL-UNNAMED

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.stage.Stage;

      public class Main extends Application {

          public static void main(String[] args) {
              Application.launch(args);
          }

          @Override
          public void start(Stage stage) {
              final Scene scene = new Scene(new Group(), 640, 480);
              stage.setScene(scene);
              stage.show();
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Activity

          People

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: