Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query for system (not JVM) uptime in Java [duplicate]

Is there a OS-neutral method of querying for system (not JVM - I am aware of RuntimeMXBean.getUptime()) uptime in JavaSE 6 ?

Thanks

like image 537
Dmitry Khalatov Avatar asked Nov 15 '22 16:11

Dmitry Khalatov


1 Answers

Yes and no.

  • There are system specific ways of querying uptime (e.g. uptime on *nix)
  • There are ways to detect the operating system.
  • There is a small finite number of likely operating systems.
  • And you're in a general purpose programming environment, so...
like image 54
MarkusQ Avatar answered Nov 17 '22 05:11

MarkusQ