2

I'm trying to develop a java application for the raspberry pi that will play mp3s.

I wrote a simple program to see if it would work using JLayer

Code for the app is like this:

public static void main(String[] args) {        
    Player player = null;

    try {
        FileInputStream fis = new FileInputStream("song.mp3");
        BufferedInputStream bis = new BufferedInputStream(fis);
        player = new Player(bis);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

    try {
        player.play();
    } catch (JavaLayerException e) {
        System.out.println(e.getMessage());
    }   
}

The program runs on windows but on the pi when creating the new player object I am getting the exception:

Cannot create AudioDevice

Has anyone been able to get JLayer working on the pi?

I'm using the latest Soft-float Debian “wheezy” image with the Orcale JVM.

Simulant
  • 651
  • 1
  • 9
  • 22
Matthew Wilson
  • 171
  • 2
  • 7

1 Answers1

1

I got this working. I had installed the Oracle JRE but it wouldn't play, but when I installed the Oracle JDK the mp3 played ok. The performance is good which was a nice surprise!

Matthew Wilson
  • 171
  • 2
  • 7