so it’s my first time trying to use an external library in IDE NetBeans 22 and I’m trying to use the JLayer external library to make an app in Java to play an animal sound (mp3 format) when I press an specific JButton. The main problem that I have it’s when I try to compile the project via cmd and I have the next compiling errors:
To give y’all more context about my problem I downloaded a .jar file named as "jl1.0.1.jar" and I imported it in a project with Ant in the previous IDE named (NetBeans) to use the ./lib in the project to import the .jar file. In the section Properties > Libraries of the Ant project I have the next settings:
And finally this is the piece of code where I’m trying to use the JLayer library:
package javaappapi;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.advanced.AdvancedPlayer;
public class ReproducirSonido
{
public void playAnimalSound(String path)
{
try
{
FileInputStream archivoMP3 = new FileInputStream(path);
AdvancedPlayer reproductor = new AdvancedPlayer(archivoMP3);
reproductor.play();
}
catch(FileNotFoundException | JavaLayerException e)
{
System.out.println(e.getMessage());
}
}
}
As I said in the beginning of this message, it’s my first time trying to import and use an external lib so be patient with me, I hope I included all the details of my problem and I’ll be waiting for your help.
You need to sign in to view this answers
Leave feedback about this