JAVA中如何在应用程序中加入音乐,除了APPLET以外还有没有其他的?
APPLET我用了 ,程序运行后就动不了了

解决方案 »

  1.   

    import java.io.FileInputStream;
    import java.io.*;
    import sun.audio.AudioPlayer;
    import sun.audio.AudioStream;public class Sound {    public Sound(){
            new Thread(new SoundThread()).start();
        }//处理声音的类
        private void play(String path){        try {
                FileInputStream in = new FileInputStream(path);
                try {
                    AudioStream au = new AudioStream(in);
                    AudioPlayer.player.start(au);
                } catch (IOException ex1) {
                    ex1.printStackTrace();
                }
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }    class SoundThread implements Runnable{
            public void run() {
               play("双鱼座.wma");
            }
        }
        
    }
    帮我看看这个类出了什么错,为什么会报错