MIDI: java.lang.IllegalArgumentException: Requested device not installed: null

Help please!?

code:
public void playMidiFrom(String path) {
try {
Sequence midi = MidiSystem.getSequence(this.getClass().getClassLoader().getResource(path));
Sequencer player = MidiSystem.getSequencer();
player.open();
player.setSequence(midi);
player.start();
} catch (IOException e) {
System.out.println(“else”);
e.printStackTrace();
} catch (InvalidMidiDataException e) {
System.out.println(“Invalid MIDI data”);
e.printStackTrace();
} catch (MidiUnavailableException e) {
System.out.println(“No midi”);
e.printStackTrace();
}
}

i get this error:

java.lang.IllegalArgumentException: Requested device not installed: null
at javax.sound.midi.MidiSystem.getGenericDevice(MidiSystem.java:1073)
at javax.sound.midi.MidiSystem.getSequencer(MidiSystem.java:277)
at CroAsteroids1.lib.sounds.Sounds.playMidiFrom(Sounds.java:89)
at CroAsteroids1.lib.sounds.Sounds.(Sounds.java:83)
at CroAsteroids1.lib.Asteroids.init(Asteroids.java:283)
at CroAsteroids1.lib.Asteroids.run(Asteroids.java:116)
at CroAsteroids1.lib.Asteroids.main(Asteroids.java:110)

I can play mid’s in Winamp. And i am not trying to play it in winamp at the same time while running the code. Using windows xp.

For midi playback you need a soundbank. The SDK/JDK comes with one… so if you use that jre it should work fine. With the default jre it doesnt really work out of the box.

You also might want to take a look at Martin Cameron’s xm and mod players (see sound forum).

thanks for the tip…i’ll look into that.

i can’t believe it can be this complicated to play a MID file using Java…