• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to shutdown the red hat linux computer

 
Abhay Ram
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody i want to write simple java program which shutdown the my computer

is this possible in java ?

please suggest me i am searching for it

thank you.....
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Runtime.exec() to execute the "/sbin/shutdown" command.

However, the Java program has to be running with root privileges. Not just anyone is allowed to shut down the system (fortunately!)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic