java - Audio does not play in Jar but does in eclipse -


sound not play when run jar, when run in eclipse.

here load clips:

public void init(){     system.out.println("grabbing music");     string currentdir = new file("").getabsolutepath();     name=new file(currentdir+"\\music\\").list();     clip=new clip[name.length];     soundfile=new file[name.length];     for(int x=0;x<name.length;x++){         system.out.println(currentdir+"\\music\\"+name[x]);         try {             soundfile[x]= new file(currentdir+"\\music\\"+name[x]);             audioinputstream sound = audiosystem.getaudioinputstream(soundfile[x]);             dataline.info info= new dataline.info(clip.class, sound.getformat());             clip[x] = (clip) audiosystem.getline(info);             clip[x].open(sound);             clip[x].addlinelistener(new linelistener(){                 public void update(lineevent event) {                     if (event.gettype() == lineevent.type.stop) {                         event.getline().close();                     }                 }             });         } catch (lineunavailableexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         } catch (unsupportedaudiofileexception e) {             e.printstacktrace();         }     }  } 

i not errors when running in eclipse. there should no possibility of invalid directory error, wrong?

-when jar run in cmd no errors.

edit: feel loading audio wrong, hence why pasted code used load files in. in searches haven't seen use file load in sound file. wonder if problem?

first thing goes mind didn't attached sound library classes jar.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -