0

I've been testing a Java library that works in both PC and Android platforms, a few time ago someone here told me to use JLayer. Today I was happily coding and then this exception showed up:

java.lang.ExceptionInInitializerError
at javazoom.jl.decoder.SynthesisFilter.load_d(Unknown Source)
at javazoom.jl.decoder.SynthesisFilter.<init>(Unknown Source)
at javazoom.jl.decoder.Decoder.initialize(Unknown Source)
at javazoom.jl.decoder.Decoder.decodeFrame(Unknown Source)
at javazoom.jl.player.Player.decodeFrame(Unknown Source)
at javazoom.jl.player.Player.play(Unknown Source)
at javazoom.jl.player.Player.play(Unknown Source)
at Main.Play(Main.java:23)
at Main.main(Main.java:164)
Caused by: java.io.IOException: unable to load resource 'sfd.ser'
at javazoom.jl.decoder.JavaLayerUtils.deserializeArrayResource(Unknown Source)
... 9 more

I've tried to google the cause for this exception with no results, so I come here begging for your help.

This is the function where I'm trying to play the audio file:

public static void Play()
{
    try
    {
        InputStream fis = new FileInputStream("L://POO//MyWS//WakeUp!//Back in black.mp3");
        Player p = new Player(fis);

        p.play();

    }
    catch(FileNotFoundException e)
    {
        e.printStackTrace();
    }
    catch (JavaLayerException e)
    {
        e.printStackTrace();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    catch(ExceptionInInitializerError e)
    {
        e.printStackTrace();
    }
}

Thank you in advance! :D

Jhon
  • 582
  • 7
  • 28
  • 1
    *"I've tried to google the cause for this exception with no results"* Try Google with 'JLayer+ExceptionInInitializerError' and get back to us after you've checked over those (about) 1,870,000 hits, or at least the first page full. – Andrew Thompson May 05 '13 at 03:39
  • I don't find anything that I didn't checked before, that's why I came here. – Jhon May 05 '13 at 03:59

2 Answers2

1

Finally I'm using JLayer 1.0 and it works like a charm, you can get it from here. This is a sample code I found here.

EDIT: in Eclipse, if the error keeps showing up, change your workspace to a new one.

Jhon
  • 582
  • 7
  • 28
0

Version of JLayer did not matter for me.

In my case, importing javazoom.jl.player.Player was not enough. When building my application into a jar, I did include jl1.0.1.jar, but I also had to make sure to include javazoom in the fileset dir of build file.

Arnold
  • 21
  • 2