You can search for something useful here .
But in general it is better to use JLayer
I connected the library to the maven project:
<dependencies> <dependency> <groupId>javazoom</groupId> <artifactId>jlayer</artifactId> <version>1.0.1</version> </dependency>
Added this library to jar-nick using maven-assembly-plugin :
<build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins>
assembly.xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly- plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven- assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/ assembly-1.1.0.xsd"> <id>with-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <unpack>true</unpack> <useTransitiveDependencies>false </useTransitiveDependencies> <excludes> <exclude>org.easytesting:*</exclude> <exclude>junit:*</exclude> <exclude>org.apache.maven.plugins:maven-surefire- report-plugin</exclude> <exclude>net.sourceforge.jexcelapi:*</exclude> </excludes> </dependencySet> </dependencySets>
This library turned out to be very easy to use, all you had to do was create an object of the javazoom.jl.player.Player class and then call its play () method.
FileInputStream stream = new FileInputStream(soundFile.getPath()); Player player = new Player(stream); player.play();