tags:

views:

133

answers:

2

I import these:

sun.audio.AudioPlayer;
sun.audio.AudioStream;

to use and play a sound, but compiler produce warining.

the sound plays well but when I run the jar file no sound is played!

NetBeans says that I'm using forbidden import.

Can someone tell me "Why the jar file does not play the sound?"

A: 

Cannot really say (based on the information) why it doesn't play but the reason you get the warning is that you are using classes that are not part of JavaSE.

If I take your code and run it on a JVM not from Sun, the risk is quite high that it will not be able to even load your code because of the missing sun.audio classes.

Fredrik
+3  A: 

Packages sun.* are for internal use only. You should use something from java-media.

MarrLiss