私のアプリに問題があります。私はEclipseでappを実行するとサウンドはうまくいっていますが、アプリケーションをrunnable jarにエクスポートするとサウンドは機能しません。サウンドが再生されjarにエクスポートした後に音声が聞こえない
方法、:
public static synchronized void playSound()
{
new Thread(new Runnable()
{
// The wrapper thread is unnecessary, unless it blocks on the
// Clip finishing; see comments.
public void run()
{
try
{
Clip clip = AudioSystem.getClip();
AudioInputStream inputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream("sound.wav"));
clip = AudioSystem.getClip();
clip.open(inputStream);
clip.start();
}
catch (Exception e)
{
System.err.println(e.getMessage());
}
}
}).start();
}
間違いすることができますか?
WaveファイルはJARに存在しますか? –
私はjarファイルを展開しようとしましたが、そこにwaveファイルが見つかりました。 – Sk1X1