Re: Remote Shutdown using Java
Eric Sosman wrote:
christopher_board@yahoo.co.uk wrote On 06/14/07 17:08,:
Hi all. I want to be able to shutdown remote computers using Java.
Below are the things that have been imported :
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.*;
import java.rmi.server.*;
import javax.swing.*;
and below is the code
public void remoteShutdown_actionPerformed(ActionEvent e) {
try{
Runtime.getRuntime().exec("shutdown -m \\toshiba_cwb -s -t
99");
}catch(Exception ex){System.out.println("Fail to
ShutDown"+ex);}
The code works fine without the the -m and the computer name, however
when I put the -m \\computerName it won't shut the computer down but
no error messages have been displayed.
What is wrong with this.
Any help in this matter would be truly appreciated.
I have no idea what this "shutdown" program you're
using is; it certainly doesn't look like the one I know.
It's the CLI way of shutting down a Windows PC. The OP took it for
granted that wanting to shutdown remote computers really meant to us
that he wanted to shutdown only Windows-based remote computers since
Windows-based computers are the only ones that exist.