File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 16308
    
  22

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to shutdown the red hat linux computer