I am trying to make a music player in java. I have gone to numerous websites and looked at resources to see how it works, but AudioInputStream gives me a nullPointerException in a place where I least expect it! It seems that no one has asked this question before (in addition, I don't have enough rep to comment so I had to make this a separate question), so I'll show you the code where it's going wrong:
Clip clip = AudioSystem.getClip();
AudioInputStream ais = AudioSystem.getInputStream(new File("mywav.wav"));
clip.open(ais);
clip.start();
I surrounded this with Thread and started the Thread, so it should play fully. But, I get a nullPointerException at the line "AudioInputStream ais = AudioSystem.getInputStream(...."