Win a copy of The Business Blockchain this week in the Cloud forum!
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic