|
Play an audio file from a JAR file |
|
|
To play a sound from a JAR file (the .AU file in the JAR must be accessible via the CLASSPATH of course!) :
import java.io.*;
import java.net.*;
import sun.audio.*;
public class AppAudio {
public static void main(String args[]) throws Throwable {
InputStream in = AppAudio.class.getResourceAsStream(args[0]);
AudioStream as = new AudioStream(in);
AudioPlayer.player.start(as);
Thread.sleep(5000);
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.