This discussion is archived
6 Replies Latest reply: Sep 7, 2011 10:24 PM by DarrylBurke RSS

MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e

886664 Newbie
Currently Being Moderated
Hi all,

I have JRE 7 and JMF 2.1.1e installed on my system to run my applet which need to play the audio. Currently, I is working fine with JRE 6 & JMF 2.1.1e, but not with JRE 7. I see that once I installed the JMF on my system, it copied the sound.jar file into the JRE installed folder (/lib/ext/), I have tried to debug the code, I see that it is hanging at line of code call MidiSystem.getSequencer(), I have no idea about the issue.
However, If I delete the sound.jar file int he JRE 7 ext folder, then the applet is just working fine.
I guess that the sound.jar in JMF 2.1.1e is not compatible with JRE 7. I have tried to find out the document of JMF about this, but no luck.
Does anyone have this problem?

Please advise,
Thanks in advance.
  • 1. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    793415 Pro
    Currently Being Moderated
    883661 wrote:
    ..I have JRE 7 and JMF 2.1.1e installed on my system to run my applet which need to play the audio. ..
    Why? The Java sound API:
    ..was incorporated into the J2SE in Java 1.3.
    (And has been developed since then, which JMF certainly has not.)

    If you want to add MP3 support to Java sound, just add the <tt>mp3plugin.jar</tt> of the JMF (details in the linked page) and your set to go.
  • 2. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    886664 Newbie
    Currently Being Moderated
    Hi,

    I am not good in Java programming. Could you please tell me more details about this? I am trying to support the old applet which has been written for years.
    Do you mean that we don't need the JMF at all if we are using the JRE 6 or 7?
    My applet is playing the .wav and .mp3 files.

    Please advise.
    Thanks.
  • 3. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    793415 Pro
    Currently Being Moderated
    883661 wrote:
    ..Do you mean that we don't need the JMF at all if we are using the JRE 6 or 7?
    ..or 5, or 4, or 3.

    The major part of the JMF is only needed to support sound in version 1 or 2. Except for..
    My applet is playing the .wav and .mp3 files.
    ..MP3 support, which as I mentioned, was gone into on the linked page. That page also shows two source files for playing both a sampled sound file and a MIDI using J2SE, and links to the package JavaDocs for version 6. What does the <tt>since</tt> element at the bottom of the package JavaDoc page report? Did you visit the linked page (and the pages to which it links) and read it carefully, or are you expecting me to spoon-feed the information to you?

    BTW - what does playing WAV and MP3 got to do with <tt>MidiSystem.getSequencer</tt>?

    (As an aside, those 3 questions are not rhetorical - I expect 3 answers.)
  • 4. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    886664 Newbie
    Currently Being Moderated
    Thank you very much. I read the page you advise me already.
    I see that my code is using the JMF to play mp3. Because I am just a newbie in Java programming so I could not understand much.:)
    I see that the code is as below:
    public void open() {
    try {
    sequencer = MidiSystem.getSequencer();
    if (sequencer instanceof Synthesizer) {
    synthesizer = (Synthesizer) sequencer;
    channels = synthesizer.getChannels();
    }
    }
    catch (Exception ex) {
    alert("equencer==null");
    return;
    }
    sequencer.addMetaEventListener(this);
    }

    I have no idea if this is correct or not. Is it related to .wav playing? I try to disable these code and there is no problem with playing .wav or mp3 and don't need to remove the sound.jar file.
  • 5. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    793415 Pro
    Currently Being Moderated
    You managed to answer (in some form) 2 out of 3 of my questions. While "2 out of 3 ain't bad", it is not enough to make me persist with the thread.

    Good luck with it!
  • 6. Re: MidiSystem.getSequencer running with JRE 7 and JMF 2.1.1e
    DarrylBurke Guru Moderator
    Currently Being Moderated
    Moderator action: Moved from Java Programming.

    db

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points