-Dsun.java.command is not updated in jps/jcmd
David Holmes
david.holmes at oracle.com
Wed Feb 13 04:37:39 UTC 2019
Hi Sundar,
On 13/02/2019 2:01 pm, Sundara Mohan M wrote:
> Hi,
> I am trying to change the main class name (listed via jps) to be
> different from actual class name used.
> For example,
> I am starting a process as com.sundar.XmlConfig as my main class but in
> jps i want to see it as com.sundar.MyApplication.
> I tried passing -Dsun.java.command=com.sundar.MyApplication in command line
> like,
> java -Dsun.java.command=com.sundar.MyApplication com.sundar.XmlConfig but
> still it is showing XmlConfig in the jps output.
>
>
> Any idea how to solve this?
I don't think you can without a custom launcher. sun.java.command is not
intended to be user-settable but is a psuedo-property used to
communicate between the launcher and the JVM. In the case of the JDK's
launcher it sets that property explicitly and appends it (and others) to
the end of the explicit command-line args e.g if you set
_JAVA_LAUNCHER_DEBUG=true you will see something like:
JavaVM args:
version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 6
option[ 0] = '-Dsun.java.launcher.diag=true'
option[ 1] = '-Dsun.java.command=com.sundar.MyApplication'
option[ 2] = '-Djava.class.path=.'
option[ 3] = '-Dsun.java.command=com.sundar.XmlConfig'
option[ 4] = '-Dsun.java.launcher=SUN_STANDARD'
option[ 5] = '-Dsun.java.launcher.pid=26724'
So your setting is then overridden by the launcher supplied setting when
the JVM processes the args.
Cheers,
David
> Thanks,
> Sundar
>
More information about the hotspot-dev
mailing list