I\'ve written an application in java and I want to add a feature to report the uptime of the application. Is there a Class/method in the JVM that can do this?
Should
The result is in milliseconds:
RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean(); System.out.println(mxBean.getUptime());
See: ManagementFactory.getRuntimeMXBean() javadoc.