How to kill a Java process and run a final glitch

I have a Java application with a final hook. The shutdown key is executed when I launch the application in IntelliJ and click the Exit button (as opposed to the Stop button, which does not exit ).

I need to disconnect a process from a Windows batch file. I tried various combinations of the taskkill without luck (assuming PID 1234):

 taskkill /pid 1234 /t taskkill /pid 1234 /f /t 

Is there a way to terminate the Java process from the MS batch file and execute Java shutdown hooks ?

The application runs on a Windows server.

+5
source share
1 answer

You should try the following:

1 Go to command line . 2 task lists.

C: \ Users \ HD> for /f "tokens=1" %i in ('jps -m ^| find "JAVA_PROCESS_NAME"') do ( taskkill /F /PID %i ) l / F / PID% i) C : \ Users \ HD> (taskkill /F /PID 5076 )

0
source

All Articles