Note that there are some explanatory texts on larger screens.

plurals
  1. POJava error: java.lang.IllegalArgumentException: Signal already used by VM: INT
    text
    copied!<p>I am investigating a Java issue (using IBM JVM 1.4.2 64-bit) on Red Hat Linux. I am wondering if anyone has seen this error message before and knows if there is a workaround to this problem?</p> <p>Source:</p> <pre><code>import sun.misc.Signal; import sun.misc.SignalHandler; public class SignalTest extends Thread { private static Signal signal = new Signal("INT"); private static ShutdownHandler handler = new ShutdownHandler(); private static class ShutdownHandler implements SignalHandler { public void handle(Signal sig) { } } public static void main(String[] args) { try { Signal.handle(signal, handler); } catch(Throwable e) { e.printStackTrace(); } try { Thread.sleep(5000); } catch(Exception e) { e.printStackTrace(); } System.exit(0); } } </code></pre> <p>Output:</p> <pre><code>java.lang.IllegalArgumentException &lt;Signal already used by VM: INT&gt; java.lang.IllegalArgumentException: Signal already used by VM: INT at com.ibm.misc.SignalDispatcher.registerSignal(SignalDispatcher.java:145) at sun.misc.Signal.handle(Signal.java:199) at xxx </code></pre> <p>Additional Information:</p> <p>I found out something strange. The reason why it fails is because I am running the program inside a shell script as a background process.</p> <p>i.e. sigtest.sh: </p> <pre><code>#!/bin/bash java -cp . SignalTest &gt;&gt; sigtest.log 2&gt;&amp;1 &amp; </code></pre> <p>If I run the program from the command line, or remove the "&amp;" (i.e. make it a foreground process inside the shell script), it doesn't have a problem... I don't understand why this is the case.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload