It really depends on your java version.
Prior to Java 8
public abstract void destroy()
Kills the subprocess. The subprocess represented by this Process
object is forcibly terminated.
Java 8
public abstract void destroy()
Kills the subprocess. Whether the subprocess represented by this
Process object is forcibly terminated or not is implementation
dependent.
public Process destroyForcibly()
Kills the subprocess. The subprocess represented by this Process
object is forcibly terminated. The default implementation of this
method invokes destroy() and so may not forcibly terminate the
process. Concrete implementations of this class are strongly
encouraged to override this method with a compliant implementation.
Invoking this method on Process objects returned by
ProcessBuilder.start() and Runtime.exec(java.lang.String) will
forcibly terminate the process.
Note: The subprocess may not terminate immediately. i.e. isAlive() may
return true for a brief period after destroyForcibly() is called. This
method may be chained to waitFor() if needed.
Returns: the Process object representing the subprocess to be forcibly
destroyed.
Java 9
public abstract void destroy()
Kills the process. Whether the process represented by this Process
object is normally terminated or not is implementation dependent.
Forcible process destruction is defined as the immediate termination
of a process, whereas normal termination allows the process to shut
down cleanly. If the process is not alive, no action is taken. The
CompletableFuture from onExit() is completed when the process has
terminated.
public Process destroyForcibly()
Kills the process forcibly. The process represented by this Process
object is forcibly terminated. Forcible process destruction is defined
as the immediate termination of a process, whereas normal termination
allows the process to shut down cleanly. If the process is not alive,
no action is taken. The CompletableFuture from onExit() is completed
when the process has terminated.
Invoking this method on Process objects returned by
ProcessBuilder.start() and Runtime.exec(java.lang.String) forcibly
terminate the process.
API Note:
The process may not terminate immediately. i.e. isAlive() may return
true for a brief period after destroyForcibly() is called. This method
may be chained to waitFor() if needed. Implementation Requirements:
The default implementation of this method invokes destroy() and so may
not forcibly terminate the process. Implementation Note: Concrete
implementations of this class are strongly encouraged to override this
method with a compliant implementation.
Returns:
the Process object representing the process forcibly destroyed