取得Java虚拟机的启动时间

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.Date;

public class JVMStartTime {
    public static void main(String[] args) {
        // Get JVM's thread system bean
        RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();

        // Get start time
        long startTime = bean.getStartTime();

        // Get start Date
        Date startDate = new Date(startTime);       

        // print values
        System.out.println("Start Time = " + startTime);
        System.out.println("Start Date = " + startDate);
    }
}