audio - How to play external sound file in Java -


how play sound in java not internally saved in java project? have tried code work file compiled in java project.. want make sound file directory apart java project.

private void sound (int s) {     try {       clip clip = audiosystem.getclip();       audioinputstream inputstream = audiosystem.getaudioinputstream(main.class.getresourceasstream("music/sound"+s+".wav"));       clip.open(inputstream);                 clip.start();               } catch (lineunavailableexception | unsupportedaudiofileexception | ioexception e) {       system.err.println(e.getmessage());     } } 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -