text: jGuru Forums
  Posted By:
  Anand_S
  Posted On:
  Monday, June 11, 2001 01:15 AM
  When an application is running, if the user presses "CTRL C" the application will exit. So I dont want to exit my application I have to trap the "CTRL C" so that when the user presses "CTRL C" then i have to perform some other functionality.
  - Thans in advance...
  Re: How to capture "CTRL C" in a java program
  Posted By:
  Simon_Ablett
  Posted On:
  Thursday, June 28, 2001 07:16 AM
  Posted By:
  Luigi_Viggiano
  Posted On:
  Monday, June 11, 2001 04:31 AM
  import java.io.IOException;public class CtrlC extends Thread { public CtrlC() { Runtime.getRuntime().addShutdownHook(this); } public void run() { System.out.println("CTRL-C catched! "); } public static void main(String[] args) { new CtrlC(); System.out.println("Press CTRL-C"); while (true) try { System.in.read(); } catch (IOException ioe) { ioe.printStackTrace(); } }}
  Posted By:
  Anonymous
  Posted On:
  Monday, June 11, 2001 02:07 AM