my dog learned polymorphism
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: 17148
    
  27

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


An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to shutdown the red hat linux computer
 
It's not a secret anymore!