• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to shutdown the red hat linux computer  RSS feed

 
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
Posts: 18792
74
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
Boost this thread!