• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Java App to detect Ctrl+C key

 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Does anyone know how to get Java to detect the Ctrl+C key that would stup down the server in order for my server to then do a clean shutdown, instead of a forces JVM shutdown.

Thanx for your help.

James.
 
Mogens Nidding
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Runtime.addShutdownHook! Use with extreme care.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!