eclipse 提示错误,请高手指点.谢谢
代码:
try
{
FileInputStream fileau=new FileInputStream("alert.wav");
AudioStream as=new AudioStream(fileau);
AudioPlayer.player.start(as);
}
catch(Exception e) { }
在调试中发出现这样的错误:
Multiple markers at this line
- Access restriction: The field player from the type AudioPlayer is not accessible due to restriction on required library F:
\jdk1.5\jre\lib\rt.jar
- Access restriction: The type AudioPlayer is not accessible due to restriction on required library F:\jdk1.5\jre\lib\rt.jar
- Access restriction: The method start(InputStream) from the type AudioPlayer is not accessible due to restriction on required
library F:\jdk1.5\jre\lib\rt.jar
[解决办法]
你使用了sun.audio.AudioPlayer 这个非公开类,需要在eclipse选项里去掉限制。