Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Destroy running Process by taking process id
package com.knoldus;
import java.util.Optional;
public class DestroyProcess {
public static void main(String[] args) {
final Optional<ProcessHandle> processHandle = ProcessHandle.of(9767);
if(processHandle.isPresent())
{
processHandle.get().destroy();
System.out.println("Process Destroyed Successfully !!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment