Executable JAR with reource structure. [message #1171551] |
Tue, 05 November 2013 05:01  |
Eclipse User |
|
|
|
Hello,
I was wondering if someone can help as I am going around in circles.
I have my project folder with working appllication it includes 2 resources folders /res - (images)
/audio - (audio files)
The application works perfectly inside Eclipse, I can also run it from command line without any problem.
When I create a executable jar file, I notice 2 things.
1) the structure inside the jar no longer exist it has put everything in / (classes, images & audio files)
2) the audio files can not be found, I tested with println(); and added the audio files call() every way I know calling it in /file.wav, /audio/file.wav, audio/file.wav, file.wav
The problem is it always say (file not found) but it runs fine in eclipse and command line calling the class.
How can I create a executable jar that maintain the structure and it works.
Many Thanks
|
|
|
Re: Executable JAR with reource structure. [message #1226849 is a reply to message #1171551] |
Thu, 02 January 2014 17:24  |
Eclipse User |
|
|
|
Ricardo,
I don't think you provided any code snippets, so I would presume you are using Sun's AudioPlayer and AudioStream classes to play a WAV file. I would suggest using a different (and shorter) method of playing a WAV file. The Applet class has a static method called newAudioClip() that takes a URL as its argument which can then be played, like so:
Applet.newAudioClip(this.getClass().getResource("RicardoWaveFile.wav")).play();
The above line is all you should need to play a WAV file.
Thanks.
Rene Bajarias
|
|
|
Powered by
FUDForum. Page generated in 0.10297 seconds