This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 15662
    
  15

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
 
Similar Threads
SHUT DOWN SYSTEM USING JAVA PROGRAM
startup and shutdown WebLogic
Boot in java
Windows 2000 Plateform...
Detect windows shutdown