-1

我使用 Eclipse Juno 并收到以下错误:

Access restriction:The type AudioPlayer is not accessible due to restriction 
    on required library C:\Program\Files\Java\jre6\lib\rt.jar

AudioStream和非常相似AudioData

如何解决这些错误?

4

1 回答 1

0

你试过音频剪辑吗?

public static final Sound sound= new Sound("/sound.wav");

private AudioClip clip;

private Sound(String name) {
    try {
        clip = Applet.newAudioClip(Sound.class.getResource(name));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}

public void play() {
    try {
        new Thread() {
            public void run() {
                clip.play();
            }
        }.start();
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
于 2013-08-10T15:27:59.437 回答