To get information about a process, we need access to the Info object of the process. This is available through a ProcessHandle. We use a call to the handle.info() method to return it.
The Info interface defines query methods that deliver information about the process. These are:
- command() returns an Optional<String> containing the command that was used to start the process
- arguments() returns an Optional<String[]> that contains the arguments that were used on the command-line after the command to start the process
- commandLine() returns an Optional<String> that contains the whole command-line
- startInstant() returns an Optional<Instant>, which essentially represents the time the process was started
- totalCpuDuration() ...