- Joined
- Oct 21, 2008
- Messages
- 1
- Reaction score
- 0
Greetings,
I have this problem when creating a .jar file of my project. In Eclipse I have my project working and when exporting it as a .jar file, sounds won't work.
In eclipse this is the folder structure:
Pname
--src
----(default package)
------Main.java
----sound
------sound1.wav
This is how I call my sound file in Main.java:
String filePath = System.getProperty("user.dir")+"\\src\\sound\\";
playAudioFile(filePath+"sound1.wav");
It works perfectly in eclipse, but after I export this into jar, the sound doesn't work. I assume I have to change the path somehow, but don't know how.
If I copy source files onto let's say D:\ and compile with javac, I have to delete the src\\ part from the filePath. And the java Main works great. But even here by creating the .jar file with jar cf ... sound doesn't work.
All I have noticed is that not jar command nor eclipses' export don't create the META-INF/INDEX.LIST file which I saw in a working .jar file. I tried adding it manually but with no success ...
Any suggestions would be great!
Best regards
I have this problem when creating a .jar file of my project. In Eclipse I have my project working and when exporting it as a .jar file, sounds won't work.
In eclipse this is the folder structure:
Pname
--src
----(default package)
------Main.java
----sound
------sound1.wav
This is how I call my sound file in Main.java:
String filePath = System.getProperty("user.dir")+"\\src\\sound\\";
playAudioFile(filePath+"sound1.wav");
It works perfectly in eclipse, but after I export this into jar, the sound doesn't work. I assume I have to change the path somehow, but don't know how.
If I copy source files onto let's say D:\ and compile with javac, I have to delete the src\\ part from the filePath. And the java Main works great. But even here by creating the .jar file with jar cf ... sound doesn't work.
All I have noticed is that not jar command nor eclipses' export don't create the META-INF/INDEX.LIST file which I saw in a working .jar file. I tried adding it manually but with no success ...
Any suggestions would be great!
Best regards
Last edited: