Created
May 16, 2019 11:50
-
-
Save kunals201/a0ea90764221e54d16dabea9fcacf726 to your computer and use it in GitHub Desktop.
Destroy running Process by taking process id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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