开发者

apache.commons.exec - swallow exception thrown by the executed process?

I use Apache's commons exec library to run another application from my java code on windows. That other application (tshark) might throw an ugly exception which makes windows pop up "an unhandled win32 exception occured in ..." window. 开发者_运维百科Is there some way to swallow that exception in my java code, so the user won't encounter that window?


Is there some way to swallow that exception in my java code, so the user won't encounter that window?

Well, not easily.

If tshark/wireshark writes something to stderr when that window you want to get rid of pops up, then you may be able to destroy() the process you just spawned when you detect whatever matching string on stderr (that would get rid of tshark/wireshark entirely, not just of the unwanted window).

Anything else is doable, like automatically closing the error window, but that would require much more work (like for example using JNA to find windows title and closing the tshark/wireshark exception window you want to get rid of).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜