java获取vm运行参数
To get the version 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 version of running Java VM.
要获取Java中正在运行的VM(虚拟机)的版本 ,我们使用System类中定义的getProperties()方法 ,在调用该方法时,我们需要传递属性名称以获取正在运行的Java VM的版本。
The property to get the running Java VM version: "java.vm.version"
获取正在运行的Java VM版本的属性: “ java.vm.version”
The method call is: System.getProperties("java.vm.version");
方法调用为: System.getProperties(“ java.vm.version”);
Java code to get and print the version 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_version = null;
vm_version = System.getProperty("java.vm.version");
System.out.println("Running Java vm version is: " + vm_version);
}
}
Output
输出量
Running Java vm version is: 10.0.1+10
翻译自: https://www.includehelp.com/java/how-to-get-the-version-name-of-running-java-vm-in-java.aspx
java获取vm运行参数