audio - Java: playing wav from resources -


i want create jar wav files on can play them resources.

while running eclipse, first declare folder locally this:

file folderstimuli= new file("c:\\users\\martin\\stimulus");      public void play(file file) throws unsupportedaudiofileexception, ioexception, lineunavailableexception{       if (status != playing) {         clip = audiosystem.getclip();         audioinputstream ais = audiosystem.getaudioinputstream(file);         clip.open(ais);         clip.addlinelistener(this.linelistener);         status = playing;         this.timestart=system.currenttimemillis();         clip.start();     } } 

i have files on project folder, namely, /src/main/resources , want create jar reads files there. beginner, don't have clue how it. please kind indicating have change here in order work?

thank much!

martin


Comments