0

I have to kill a Java process gracefully from windows. The requirement is that there is a Java main class XYZ.java which has a shutdown hook added named ABC.java containing some piece of code.I have to run code present in ABC.java when XYZ.java terminates.

In linux, I am able to do so using 'kill' command. In windows, I used below command but that's not killing my class gracefully: WMIC PROCESS where "Name='java.exe' AND CommandLine LIKE '%%XYZ%%'" CALL TERMINATE.However, I am able to achieve this windows by running CTRL+C while running java process XYZ from cmd.

Please suggest.

Bhavya Sharma
  • 309
  • 3
  • 15

0 Answers0