Search code examples
javaswingaudiojlayer

convert a java project (I used in it JLayer 1.0.1 to play mp3) to a runnable jar file


I built a java project and I used (JLayer 1.0.1) to play mp3 audio. when I test my project with eclipce I find that it worked correctly 100% and the JLayer 1.0.1 libraries play my mp3 files efficiently. but when I convert it into a runnable jar file it works with NO SOUND OR AUDIO. It seems that my program can't reach for Jlayer 1.0.1 libraries. So now,I need your help to resolve this problem. with my thanks


Solution

  • You can do the following in order to test your application: export your project as a regular jar and copy it together with the JLayer.jar and other dependencies to a directory. Then, create a batch file (.bat on Windows, .sh on Linux) that would include something like this:

    java -cp yourjar.jar;JLayer.jar;other_jars FullPathToYourClass
    

    where FullPathToYourClass is something like com.something.else.ClassName Also note the the separator on Linux is :

    Once you see it working, you can start to do a build script to do the above automatically. I would suggest you build an Ant build.xml file for this.