

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get system start time from RuntimeMXBean in Java
RuntimeMXBean in the management interface for the runtime system of the Java virtual machine.
RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean();
To get the system start time, use the getStartTime() method −
new Date(runtimeMX.getStartTime()
The following is an example −
Example
import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.Date; public class Demo { public static void main(String args[]) throws Exception { RuntimeMXBean runtimeMX = ManagementFactory.getRuntimeMXBean(); System.out.println("System Start Time = "+new Date(runtimeMX.getStartTime())); } }
Output
System Start Time = Mon Nov 26 07:03:19 UTC 2018
- Related Questions & Answers
- Get the system properties from RuntimeMXBean in Java
- Get ClassPath from RuntimeMXBean in Java
- Get Boot path from RuntimeMXBean in Java
- Get the JVM uptime from RuntimeMXBean in Java
- Get elapsed time in Java
- System privilege to start/stop a SAP HANA system
- Get current time information in Java
- How to get the start time of a long running Linux Process?
- Get the default system properties in Java
- How to get (format) date and time from mill seconds in Java?
- Time-Sharing Operating system
- Print system time in C++
- Get elapsed time in minutes in Java
- Get elapsed time in days in Java
- Get time in milliseconds using Java Calendar
Advertisements