Close a running program from a java application

I open an external application from my java application. How to close an application from one Java application? thank

+3
source share
3 answers

The best thing you can do (without going into messy / complex / platform-specific things) is to call Process.kill()in the Process object that you got when you started the external application.

I do not think that this guarantees closing the application * and there is a possibility that it can lead to its closing uncleanly; that is, without giving applications the ability to save open files, etc.

* , * NIX, "setuid root" - Java-, - .

+2

(Windows) script (* nix) , , runtime.exec start/stop?

:

: http://it.toolbox.com/blogs/database-solutions/kill-a-process-in-windows-bat-19875

exe, : 'tasklist ^| findstr /i excel.exe'

0

Windows . 25 (, , 25- ), Java... Windows , ... (cmd/c , )

0

Source: https://habr.com/ru/post/1780125/


All Articles