Yeh, I think it is. I can always execute jar files from desktop, or from within folders on the desktop.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35438
9
posted
0
That's not the same thing. It's perfectly possible to double-click and run jar files in a directory without the directory being in the classpath.
But since the mechanism used to load that wav file relies on the file being in the classpath, it's not going to work if the directory it's in now (the Desktop directory) is not in the classpath.
Using this mechanism for resources that are not in the jar file itself is error-prone for exactly this reason.
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
posted
0
Yeh, but I've tried putting resources in the jar file, that doesn't work either, or if it does, it will only work on my machine, or it wont work on a mac, or something annoying.
I give up
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
posted
0
Ok, I saved the wav file "sounds/music.wav" in with jar file. When I run the jar file from my desktop, sometimes the whole file will play, sometimes just a couple of seconds.
When I run the application from within eclipse it works perfectly. Is there any way I can fix it so the sound works properly when I run the jar from my desktop?