JVM Input Arguments Lookup (JMX)(转)

本文介绍如何使用JMX获取JVM的输入参数,但不包括main方法的参数。通过RuntimeMXBean.getInputArguments()方法可以访问这些参数。需要注意的是,不是所有的'java'命令行选项都会传递给JVM。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

JVM Input Arguments Lookup (JMX)

Maps JVM input arguments -- but not main arguments -- using JMX to acquire the JVM arguments.

Use the prefix jvmrunargs to access JVM arguments.

See the Javadocs for java.lang.management.RuntimeMXBean.getInputArguments() .

Java's JMX module is not available on Android.

getInputArguments
List<String> getInputArguments()
Returns the input arguments passed to the Java virtual machine which does not include the arguments to the  main method. This method returns an empty list if there is no input argument to the Java virtual machine.

Some Java virtual machine implementations may take input arguments from multiple different sources: for examples, arguments passed from the application that launches the Java virtual machine such as the 'java' command, environment variables, configuration files, etc.

Typically, not all command-line options to the 'java' command are passed to the Java virtual machine. Thus, the returned input arguments may not include all command-line options.

 

getInputArguments
List<String> getInputArguments()
Returns the input arguments passed to the Java virtual machine which does not include the arguments to the  main method. This method returns an empty list if there is no input argument to the Java virtual machine.

Some Java virtual machine implementations may take input arguments from multiple different sources: for examples, arguments passed from the application that launches the Java virtual machine such as the 'java' command, environment variables, configuration files, etc.

Typically, not all command-line options to the 'java' command are passed to the Java virtual machine. Thus, the returned input arguments may not include all command-line options.

http://docs.oracle.com/javase/8/docs/api/java/lang/management/RuntimeMXBean.html#getInputArguments--

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值