我使用 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
。
如何解决这些错误?
你试过音频剪辑吗?
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();
}
}