wood burning stoves
The moose likes Linux / UNIX and the fly likes How to shutdown the red hat linux computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to shutdown the red hat linux computer " Watch "How to shutdown the red hat linux computer " New topic
Author

How to shutdown the red hat linux computer

Abhay Ram
Greenhorn

Joined: Dec 14, 2010
Posts: 7
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

Joined: Jun 25, 2001
Posts: 16541
    
  25

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!)


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: How to shutdown the red hat linux computer