java获取vm运行参数
To get the name of running VM (Virtual Machine) in Java, we use the getProperties() method, which is defined in System class, while calling the method, we need to pass the property name to get the name of running Java VM.
要获取Java中正在运行的VM(虚拟机)的名称 ,我们使用System类中定义的getProperties()方法 ,在调用该方法时,我们需要传递属性名称以获取正在运行的Java VM的名称。
The property to get the name of running Java VM is: "java.vm.name"
获取正在运行的Java VM的名称的属性是: “ java.vm.name”
The method call is: System.getProperties("java.vm.name");
方法调用为: System.getProperties(“ java.vm.name”);
Java code to get and print the name of running Java VM
Java代码获取并打印正在运行的Java VM的名称
// Java program to demonstrate the example of
// getProperties() method of System Class
import java.lang.*;
import java.util.Properties;
public class Main {
public static void main(String[] args) {
String vm_name = null;
vm_name = System.getProperty("java.vm.name");
System.out.println("Running Java vm is: " + vm_name);
}
}
Output
输出量
Running Java vm is: Java HotSpot(TM) 64-Bit Server VM
翻译自: https://www.includehelp.com/java/how-to-get-the-name-of-running-java-vm-in-java.aspx
java获取vm运行参数