O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Obtaining the process information of the current JVM

A running process has a set of attributes associated with it, such as the following:

  • PID: This uniquely identifies the process
  • Owner: This is the name of the user who launched the process
  • Command: This is the command that runs under the process
  • CPU time: This indicates the time for which the process has been active
  • Start time: This indicates the time when the process was launched

These are a few attributes that we are generally interested in. Perhaps, we would also be interested in CPU usage or memory usage. Now, getting this information from within Java was not possible prior to Java 9. However, in Java 9, a new set of APIs have been introduced, which enables us to get the basic information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required