java.io.IOException: mark/reset 不受支持
2022-08-31 11:58:57
try {
//String location = dir1.getCanonicalPath()+"\\app_yamb_test1\\mySound.au";
//displayMessage(location);
AudioInputStream audio2 = AudioSystem.getAudioInputStream(getClass().getResourceAsStream("mySound.au"));
Clip clip2 = AudioSystem.getClip();
clip2.open(audio2);
clip2.start();
} catch (UnsupportedAudioFileException uae) {
System.out.println(uae);
JOptionPane.showMessageDialog(null, uae.toString());
} catch (IOException ioe) {
System.out.println("Couldn't find it");
JOptionPane.showMessageDialog(null, ioe.toString());
} catch (LineUnavailableException lua) {
System.out.println(lua);
JOptionPane.showMessageDialog(null, lua.toString());
}
当我从 netbeans 运行应用程序时,此代码工作正常。声音播放,没有例外。但是,当我从dist文件夹运行它时,声音无法播放,我在我的消息对话框中得到了。java.io.IOException: mark/reset not supported
我该如何解决这个问题?