Home arrow static arrow Java Programming [Archive] - Make sound when the java program ends
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Make sound when the java program ends
This topic has 3 replies on 1 page.

Posts:84
Registered: 7/6/04
Make sound when the java program ends  
Jul 9, 2004 9:43 AM



 
I like to know if there is a simple way to output a simple audio sound/clip when a java program end.
The reason is the program take a couple of hours to run and a sound will alert the users that the program ended.

The program is run from dos command line so there is no applet or gui....

is such a simple thing exists
 

Posts:929
Registered: 9/30/02
Re: Make sound when the java program ends  
Jul 9, 2004 9:55 AM (reply 1 of 3)



 
very simple sound:
Toolkit.getDefaultToolkit().beep();

for more complicated sounds such as reading audio files, you can do it using classes found in the javax.sound.<midi/sampled> packages. Search the forums and read the API on how to use them.
 

Posts:243
Registered: 3/18/04
Re: Make sound when the java program ends  
Jul 9, 2004 9:55 AM (reply 2 of 3)



 
Just before your call to System.exit(0) put:
java.awt.Toolkit.getDefaultToolkit().beep();
 

Posts:84
Registered: 7/6/04
Re: Make sound when the java program ends  
Jul 9, 2004 2:27 PM (reply 3 of 3)



 
thanks..yes i tried and i got a small beep...

this will be hard to notice....anyway i can replace this sound with a longer clip or anything
 
This topic has 3 replies on 1 page.