[preview] Adding java.lang.Runtime.getVMArguments() method

Roger Riggs Roger.Riggs at Oracle.com
Tue Nov 24 17:05:58 UTC 2015


Hi Jaroslav,

The arguments may contain sensitive information so the method will need 
a SecurityManager
check and appropriate permission. The method name should be more 
appropriate; the JRE is not just the VM.
Perhaps commandArguments() or something that related to the process 
command arguments as a whole.

Roger


On 11/24/2015 11:49 AM, Jaroslav Bachorik wrote:
> Hi,
>
> while working on an issue to clean up a code in java.base module using 
> reflection to access RuntimeMXBean (from java.management module) in 
> order to get hold of the VM arguments (yes, this won't work with 
> module boundaries in place) it was pointed out that this functionality 
> should be available in java.base without going through JMX.
>
> For this, java.lang.Runtime seems to be the right place to add such 
> functionality.
> A new public method 'List<String> getVMArguments()' would be added 
> with the same functionality as is currently provided by 
> j.l.m.RuntimeMXBean#getInputArguments().
>
> While the change seems to be rather non-controversional I would rather 
> discuss it before going further with the implementation and requesting 
> code review.
>
> Thanks,
>
> -JB-




More information about the core-libs-dev mailing list