0

I am creating a SWT Application which invokes an external executable (say abc.exe) in java.lang.Process. This new process is created on 'Start' button on my composite.

The problem is that if the executbale abc.exe hangs; my entire SWT shell hangs! So I thought of adding new button called 'Stop' so the user can easily kill the hung process, but since everything executes in a single thread I am not able to press 'Stop' also.

Can anyone tell me/show me how best way I can solve this problem.

Many Thanks, Tor

4

2 回答 2

1

您将需要在后台线程中运行该进程。问题是您在同一个线程中同时运行 SWT 应用程序和 abc.exe。会发生什么,是进程轮流请求/响应,并且 abc.exe 进程没有响应,所以它坐在那里等待 - 如果 abc.exe 正在执行长时间运行的算法,也会发生同样的情况。

于 2012-07-03T20:19:56.360 回答
0

进程终止实际上在java中没有实现,因为它非常危险

于 2012-07-03T20:35:31.203 回答