자바 프로그램이 네이티브 메세드(C, C++ 같은 네이티브 프로그래밍 언어로 작성된 메서드)를 호출하는 기술
public class JavaProcess {
public static void main(String[] args) {
ProcessHandle processHandle = ProcessHandle.current();
System.out.println(ProcessHandle.of(processHandle.pid()).orElse(null));
System.out.println("Native process ID of the process: " + processHandle.pid()); // process id
System.out.println("\nDirect children: " + processHandle.children());
System.out.println("\nClass name: " + processHandle.getClass());
System.out.println("\nAll processes: " + ProcessHandle.allProcesses());
System.out.println("\nProcess info: " + processHandle.info());
System.out.println("\nIs process alive: " + processHandle.isAlive());
System.out.println("\nProcess's parent " + processHandle.parent());
//Process snapshot of the current running process with ProcessHandle.Info:
ProcessHandle.Info processInfo = processHandle.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());
}
}