JDK-8138944 : Support command line arguments to the JVM passed to self-contained app launchers
  • Type: Enhancement
  • Component: deploy
  • Sub-Component: packager
  • Affected Version: 8u45
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2015-09-30
  • Updated: 2022-05-20
  • Resolved: 2017-04-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_minorResolved
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Since 8u40, self-contained applications pass command line arguments to the Java runtime. This is great. However, there is no way to configure the behavior of the JVM itself via the command line, when invoking the application through the native launcher.

It seems the only way to control the JVM environment (max heap size, -verbose mode, remote debugging, etc.) is to use the UserJvmOptionsService, then restart the application. It would be more convenient if JVM flags could somehow be passed to the native launcher itself on the CLI.

JUSTIFICATION :
Without this feature, there is no way to pass arguments to the JVM "on the fly" without launching the application twice.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
One way to avoid ambiguity between JVM arguments and application-side arguments would be to use the classic "--" Unix-style divider. So e.g.:

    MyImageViewer -Xmx512m -verbose -- myFile.png

Could pass "-Xmx512m -verbose" to the JVM, and "myFile.png" to the application.

But this RFE is less concerned with the exact syntax, and more with making it possible whatsoever to configure the JVM on the CLI.

ACTUAL -
The actual behavior currently is that all arguments are simply passed through to the Java application.

---------- BEGIN SOURCE ----------
You can reproduce by deploying the JavaFX Hello World example as a self-contained application as described at:

https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_tasks.html#CHDBGIJG

Then try passing a JVM argument to the native application launcher.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I discuss some possible workarounds on a StackOverflow post I made about this topic:

    http://stackoverflow.com/q/30809330/1207769


Comments
Covered in JEP.
27-04-2017

The team has discussed this and the standard for Java has been to use the -J<option> argument. It's very unlikely to conflict, it allows the for the most flexibility with the ability to mix arguments. So for example: mytestapp -foo -bar -J-Xmx512m -goo -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 I will be adding a shortcut for debug that is -Xdebug:<port>
06-04-2016

When we did the rewrite for 8u40 we considered what to do with heap size and debugging. We ran out of time and we didn't want to introduce something that we weren't 100% happy with. The solution that we will probably go with is to strip out any -X* arguments and process two special case arguments: -Xmx* -Xdebug:* -Xmx would simply be passed to the JVM on startup. -Xdebug:* would be replaced with a value located in the .cfg file and the value after the colon would be the port number which would be placed into that value and passed to the JVM. For example: app.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:PORTNUMBER Feedback is welcome.
22-03-2016

Incorrect, the JVM user overrides can be set by modifying the jvm user overrides config file: • Mac ~/Library/Application Support/[app.preferences.id]/packager/jvmuserargs.cfg • Windows C:\Users\[username]\AppData\Roaming\[app.preferences.id]\packager\jvmuserargs.cfg • Linux ~/.local/[app.preferences.id]/packager/jvmuserargs.cfg
21-03-2016