import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
public class JVMInfo {
public static void main(String[] args) {
// 获取 RuntimeMXBean 实例
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
// 获取 JVM 运行时名称
String jvmName = runtimeMxBean.getName();
System.out.println("JVM Name: " + jvmName);
// 从运行时名称中解析出 LVMID
long lvmid = Long.parseLong(jvmName.split("@")[0]);
System.out.println("LVMID: " + lvmid);
}
}
06-02
1026
10-05
204