
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
How to get a snapshot of information about Process API in Java 9?
Java 9 has improved Process API by including new methods and introduced new interfaces ProcessHandle and ProcessHandle.Info to get all the details regarding the process and its information.
ProcessHandle interface can identify and provide control of native processes. Each individual process can be monitored for liveness, listed its children, get information about the process, or destroys it. ProcessHandle.Info interface gives information snapshots about a process.
Syntax
ProcessHandle.Info info()
Example
public class ProcessSnapShotTest { public static void main(String[] args) { ProcessHandle currentProcessHandleImpl = ProcessHandle.current(); // Process snapshot of the current running process with ProcessHandle.Info: ProcessHandle.Info processInfo = currentProcessHandleImpl.info(); System.out.println("nProcess snapshot of the current running process:"); System.out.println("User : " + processInfo.user().get()); System.out.println("Start Time : " + processInfo.startInstant().get()); } }
Output
Process snapshot of the current running process: User : Tutorialspoint\User Start Time : 2020-05-01T05:44:41.458Z
- Related Articles
- How to get all children of a process using Process API in Java 9?
- How to get the parent process of the Process API in Java 9?
- How to traverse a process tree of Process API in Java 9?
- How to terminate/destroy a process using Process API in Java 9?
- How to retrieve all processes data of Process API in Java 9?
- What are the improvements in Process API in Java 9?
- What are the new methods added to Process API in Java 9?
- What are the core library changes in Process API in Java 9?
- How to get month information in android using yearmonth API class?
- C# Program to get information about a file
- StackWalker API in Java 9?
- How can we get an ID of the running process in Java 9?
- How to get information about USB mounted or not in android?
- How to create a process using ProcessBuilder in Java 9?
- How to print all attributes in StackFrame API in Java 9?

Advertisements