How do i get my java screensaver to play music files?

i have written a java screensaver and it works. i then add code to the screensaver to have it play mp3 files. but it works only if i launch the screensaver from a dos window (music plays and the screensaver runs in the ScreensaverFrame). the screensaver will quit if the system launches it (or if launched by clicking on the "Preview" button).

is it possible to have a java screensaver play music (music files stored locally on my computer)?

thanks.

[468 byte] By [anonimudsa] at [2007-10-3 8:30:03]
# 1

i forgot to say that the screensaver quit because System.exit(1) was in one

of the exception blocks (now removed and the screensaver continues to run

but no music played).

// audioFilename = "C:\\Music\\Test.mp3";

File audioFile = new File(audioFilename);

try

{

// always throws an exception when the screensaver is launched by the system

AudioInputStream audioInStream = AudioSystem.getAudioInputStream(audioFile);

playSelected = true;

}

catch(UnsupportedAudioFileException uafx)

{

}

catch(IOException iox)

{

}

if(playSelected) play(); // code omitted for brevity

anonimudsa at 2007-7-15 3:37:02 > top of Java-index,Java Essentials,Java Programming...