我正在尝试用 Java 播放音乐,但我无法解决这个问题。
package Mplayer;
import java.io.File;...
public class Music
{
private static final String AudioPlayer = null;
public static void main(String[] args)...
public static void playMusic(String filepath)
{
InputStream music;
try
{
music = new FileInputStream(new File(filepath));
AudioInputStream audios = new AudioInputStream((TargetDataLine) music);
AudioPlayer.player.start(audios);
}
catch (Exception e)
{
// TODO: handle exception
JOptionPane.showMessageDialog(null, "Error");
}
}
}
不管我把它改成什么,播放器都不会工作。