Hi all, just two quickies
Firstly, is there any way of making a Java method to shutdown a computer? I
need to be able to shitdown the server from a remote location, I can do the
sockets and all that bit but the only way I can think of at the moment is
moving the mouse around and shutting it down like that, which could take a
while to code.
Secondly, This may sound really simple but which Audio class from the Java
1.4.2 API should be used to open, play, stop and pause audio files
preferably *.mp3 and *.wma. I keep looking through the API but cant find a
single class which seems to deal with this.
Thanks in advance on either/both points
JS
impaler - 18 Jan 2006 10:21 GMT
what server ? running what ?
JNI, Corba etc should do it.
JS - 18 Jan 2006 10:53 GMT
Sorry, I forgot about details of the system. its a simple win98SE
installation that i want to shutdown. I can call the method easily enough
over the network but its what the method does that im stuck on.
Thanks for your help so far everyone, any more suggestions welcome
JS
> what server ? running what ?
> JNI, Corba etc should do it.
Roedy Green - 18 Jan 2006 11:55 GMT
>Sorry, I forgot about details of the system. its a simple win98SE
>installation that i want to shutdown. I can call the method easily enough
>over the network but its what the method does that im stuck on.
see http://mindprod.com/jgloss/shutdown.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 18 Jan 2006 10:22 GMT
>Firstly, is there any way of making a Java method to shutdown a computer? I
>need to be able to shitdown the server from a remote location, I can do the
>sockets and all that bit but the only way I can think of at the moment is
>moving the mouse around and shutting it down like that, which could take a
>while to code.
This is platform specific. You exec an external program or whatever
your platform calls a bat file to do it. See
http://mindprod.com/jgloss/exec.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 18 Jan 2006 10:22 GMT
>Secondly, This may sound really simple but which Audio class from the Java
>1.4.2 API should be used to open, play, stop and pause audio files
>preferably *.mp3 and *.wma. I keep looking through the API but cant find a
>single class which seems to deal with this.
>Thanks in advance on either/both points
>JS
see http://mindprod.com/jgloss/sound.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Haider Albassam - 18 Jan 2006 10:30 GMT
Hi,
I will answer the first question, since the shutdown function is not a
part of the standard Java AFAIK:
1. You have to write a DLL that uses a function like ExitWindowEx.
2. Use the JNI to access and use this DLL.
-Haider
Chris Uppal - 18 Jan 2006 10:44 GMT
> Firstly, is there any way of making a Java method to shutdown a computer?
No.
Since that's (very!) platform-dependent, probably the easiest thing to do is
find the appropriate external command (for your combination of local and remote
OSes -- which of course may be different), and then execute that program from
Java.
-- chris