Two quick questions

J

JS

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
 
R

Roedy Green

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
 
R

Roedy Green

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
 
H

Haider Albassam

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
 
C

Chris Uppal

JS said:
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
 
J

JS

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top