Results 1 to 3 of 3
  1. #1
    kmckinley820 is offline Member
    Join Date
    Feb 2011
    Posts
    7
    Rep Power
    0

    Default Help: " no pulse-java" problem - Head First Java

    I'm reading "Head First Java" right now and I'm having trouble getting some code to work that is straight from the book. Below is the code. This program is a simple midi player. It compiles fine, but at run time it messes up.

    Java Code:
    import javax.sound.midi.*;
    
    
    public class MiniMiniMusicApp {
    	
    	public static void main(String[] args) {
    		MiniMiniMusicApp mini = new MiniMiniMusicApp();
    		mini.play();
    	}
    	
    	public void play() {
    		
    		try {
    			Sequencer player = MidiSystem.getSequencer();
    			player.open();
    			
    			Sequence seq = new Sequence(Sequence.PPQ, 4);
    			
    			Track track = seq.createTrack();
    			
    			ShortMessage a = new ShortMessage();
    			a.setMessage(144, 1, 44, 100);
    			MidiEvent noteOn = new MidiEvent(a, 1);
    			track.add(noteOn);
    			
    			ShortMessage b = new ShortMessage();
    			b.setMessage(128, 1, 44, 100);
    			MidiEvent noteOff = new MidiEvent(b, 16);
    			track.add(noteOff);
    			
    			player.setSequence(seq);
    			
    			player.start();
    		} catch (Exception ex) {
    			ex.printStackTrace();
    		}
    	}
    }
    Below is what is happening when I run the code. Does anyone know what I'm doing wrong or missing?


    Exception in thread "main" java.lang.UnsatisfiedLinkError: no pulse-java in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1681)
    at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    at java.lang.System.loadLibrary(System.java:1047)
    at org.classpath.icedtea.pulseaudio.SecurityWrapper.l oadNativeLibrary(SecurityWrapper.java:27)
    at org.classpath.icedtea.pulseaudio.EventLoop.<clinit >(EventLoop.java:105)
    at org.classpath.icedtea.pulseaudio.PulseAudioMixer.o penImpl(PulseAudioMixer.java:654)
    at org.classpath.icedtea.pulseaudio.PulseAudioMixer.o penLocal(PulseAudioMixer.java:588)
    at org.classpath.icedtea.pulseaudio.PulseAudioMixer.o penLocal(PulseAudioMixer.java:584)
    at org.classpath.icedtea.pulseaudio.PulseAudioMixer.o pen(PulseAudioMixer.java:579)
    at org.classpath.icedtea.pulseaudio.PulseAudioDataLin e.open(PulseAudioDataLine.java:95)
    at org.classpath.icedtea.pulseaudio.PulseAudioSourceD ataLine.open(PulseAudioSourceDataLine.java:75)
    at com.sun.media.sound.SoftSynthesizer.open(SoftSynth esizer.java:1077)
    at com.sun.media.sound.SoftSynthesizer.open(SoftSynth esizer.java:1036)
    at com.sun.media.sound.SoftSynthesizer.getReceiverRef erenceCounting(SoftSynthesizer.java:1337)
    at javax.sound.midi.MidiSystem.getSequencer(MidiSyste m.java:431)
    at javax.sound.midi.MidiSystem.getSequencer(MidiSyste m.java:365)
    at MiniMiniMusicApp.play(MiniMiniMusicApp.java:14)
    at MiniMiniMusicApp.main(MiniMiniMusicApp.java:8)

  2. #2
    kmckinley820 is offline Member
    Join Date
    Feb 2011
    Posts
    7
    Rep Power
    0

    Default

    I forgot to mention that my OS is ubuntu 10.10

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

Similar Threads

  1. Replies: 2
    Last Post: 11-06-2011, 04:40 PM
  2. Replies: 6
    Last Post: 12-04-2010, 08:36 AM
  3. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  4. Replies: 1
    Last Post: 11-20-2009, 07:58 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •