audio - Sound trouble in Java -


enter image description here

enter image description here

enter image description here

hello, got trouble using sounds in java. wanted implement fancy 8 bit sounds newest retro 2d game.... when run in java eclipse fine , sounds work....

but run finished application (the application works perfect...) sounds wont play , there error can see in 3d picture.

picture 1 shows "sound method" , picture 2 how use it.

how fix this?

i found solution. changed code of audio method slightly.... , reason works now. here's code of it.

 public void playsound(string soundfile) {         try {              audioinputstream audioin = audiosystem.getaudioinputstream(this.getclass().getresource("/sounds/" + soundfile));             clip clip = audiosystem.getclip();             clip.open(audioin);             clip.start();         } catch (unsupportedaudiofileexception e) {              e.printstacktrace();           } catch (ioexception e) {              e.printstacktrace();           } catch (lineunavailableexception e) {              e.printstacktrace();           }     } 

Comments