Get the JVM uptime from RuntimeMXBean
import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Main { public static void main(String args[]) throws Exception { RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean(); System.out.println(mx.getUptime() + " ms"); } }