Mike Folwer
Mike Folwer

Reputation: 11

send SIGINT signal from Java to an external process

I have created JAVA SWT based GUI which interacts with external C++ executable. My GUI invokes this c++ process using ProcessBuilder. Inside C++ process executable I have overloaded signal function (CTRL+c, CTRL+D). My question is how can i send CTRL+C into this external C++ process from Java SWT GUI? I tried Runtime.getRuntime().exec((kill SIGINT pid) provided in the link:"How to send SIGINT signal from Java to an external process?" from java code. Also I tried to send kill SIGINT pid from shell console too when C++ process is excuting and it seem to be not responding sometimes. Is the call kill SIGINT itself have some problem? Can anyone provide alternate solution to achieve this? Thanks in advance.

Upvotes: 1

Views: 1159

Answers (1)

RandomSeed
RandomSeed

Reputation: 29759

If you tried to signal SIGINT to your process from the console, and it did not react, then this has nothing to do with Java, but your process just does not handle this signal.

Try sending the more radical (non ignorable) SIGKILL signal.

Upvotes: 2

Related Questions