1

I am using JLayer to play an mp3 file

the following code works after compiling the project into a jar with the command java - jar blahblahblah.jar

but not with linux.... any ideas? I get java.lang.ClassNotFoundException: javazoom.jl.decoder.JavaLayerException

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player; 
public class Mp3JLayerTest 
{

/**
 * @param args the command line arguments
 */
String filename;
String directory;
File mp3File;
static Player player;
public static void main(String[] args) throws FileNotFoundException, JavaLayerException 
{
        FileInputStream fis;
        fis = new FileInputStream("kalimba.mp3");
        BufferedInputStream bis = new BufferedInputStream(fis);
        player = new Player(bis);
        player.play();
        new Thread((Runnable) new Mp3JLayerTest()).start();

}

public void run() throws JavaLayerException 
{ 
    player.play();
}

}

  • I am attempting to run on raspberry pie with build 1.7.0_40-b43 on linux – user2698080 Nov 10 '14 at 23:02
  • Your title says the contrary as your message – Dici Nov 10 '14 at 23:06
  • just updated hopefully it will avoid confusion :) – user2698080 Nov 10 '14 at 23:09
  • windows 1.7_45 just checked if that helps, will continue to google and experiment, if I come up with an answer will post back – user2698080 Nov 10 '14 at 23:18
  • Did you check this class is in the jar ? – Dici Nov 10 '14 at 23:32
  • yes, within netbeans I have the added jar file and the class is present. – user2698080 Nov 10 '14 at 23:33
  • Wait... I thought you were running a jar with command line. What does Netbeans have to do with that ? – Dici Nov 10 '14 at 23:35
  • within windows I am using netbeans to add the jar to the project file compiling out the new jar project file and running via commandline in linux, that way the included jar is within the new compiled jar.... this works in windows by executing the runnable jar file by double clicking or running via command line. in linux I transfer the compiled jar over and run via command line – user2698080 Nov 10 '14 at 23:41
  • Well that last sentence probably is the problem. Try the same command in the folder where the jar was created. Also, can you run your project from NetBeans ? – Dici Nov 10 '14 at 23:56
  • windows yes, also commandline windows yes..... – user2698080 Nov 11 '14 at 00:09
  • when i move it over to my pi no – user2698080 Nov 11 '14 at 00:09
  • What if you decompress the library jar so that the binary files are on the same level as your classes ? Build your project by hand – Dici Nov 11 '14 at 00:11
  • ill give it a shot and see how it goes – user2698080 Nov 11 '14 at 00:15
  • ended up going a different way with this using python and pygame for mp3 output/gpio control/tcp server and java for control with a Android application. – user2698080 Nov 25 '14 at 19:59

0 Answers0