1

我正在使用 JLayer 播放 mp3 文件

以下代码在使用命令 java - jar blahblahblah.jar 将项目编译成 jar 后工作

但不是 linux.... 有什么想法吗?我得到 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();
}

}

4

0 回答 0