1.通過(guò)getResourceAsStream()讀取 InputStream is =this.getClass().getResourceAsStream("/sounds/building.mp3"); InputStream bufferedIn = new BufferedInputStream(is); audioInputStream = AudioSystem.getAudioInputStream(bufferedIn);2.通過(guò)url來(lái)讀取 URL url = getClass().getResource("/sounds/building.mp3"); audioInputStream = AudioSystem.getAudioInputStream(url );3.文件訪(fǎng)問(wèn)形式 File file = new File(filepath); audioInputStream = AudioSystem.getAudioInputStream(filepath);3.解決音頻包的正確引用 jl1.0.jar tritonus_mp3 tritonus_share.jar |
|