Hi there, I was wondering how to play a .wav file in straight java using getResourceAsStream() (or something similar) any help is very appriciated! Thanks
public static synchronized void playSound(final String url) { new Thread(new Runnable() { public void run() { try { Clip clip = AudioSystem.getClip(); AudioInputStream inputStream = AudioSystem.getAudioInputStream( Main.class.getResourceAsStream("/path/to/sounds/" + url)); clip.open(inputStream); clip.start(); } catch (Exception e) { System.err.println(e.getMessage()); } } }).start(); }