I am new to Java Applets.I installed the JMStudio and added all the .jar files in the project but still not working.
I have installed the .jar Files in the the Project>Properties>Java Build Path>Libraries
Here`s My Program:
import java.applet.*;
import java.awt.Button;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class design extends Applet implements ActionListener
{
Button play,stop;
AudioClip audioClip;
public void init(){
play = new Button(" Play in Loop ");
add(play);
play.addActionListener(this);
stop = new Button(" Stop ");
add(stop);
stop.addActionListener(this);
audioClip = getAudioClip(getCodeBase(), "About Time.mid");
}
@Override
public void actionPerformed(ActionEvent ae) {
Button source = (Button)ae.getSource();
if (source.getLabel() == " Play in Loop "){
audioClip.play();
}
else if(source.getLabel() == " Stop "){
audioClip.stop();
}
}
}
And here`s the errors
java.lang.IllegalAccessError: tried to access class com.sun.media.sound.Printer from class com.sun.media.sound.HeadspaceSoundbank
at com.sun.media.sound.HeadspaceSoundbank.<init>(HeadspaceSoundbank.java:81)
at com.sun.media.sound.HsbParser.getSoundbank(HsbParser.java:69)
at javax.sound.midi.MidiSystem.getSoundbank(MidiSystem.java:535)
at com.sun.media.sound.SoftSynthesizer.getDefaultSoundbank(SoftSynthesizer.java:711)
at com.sun.media.sound.SoftSynthesizer.openStream(SoftSynthesizer.java:1150)
at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(SoftMidiAudioFileReader.java:73)
at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(SoftMidiAudioFileReader.java:145)
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1113)
at com.sun.media.sound.JavaSoundAudioClip.<init>(JavaSoundAudioClip.java:102)
at sun.applet.AppletAudioClip.createAppletAudioClip(AppletAudioClip.java:125)
at sun.applet.AppletAudioClip.<init>(AppletAudioClip.java:66)
at sun.applet.AppletViewer.getAudioClip(AppletViewer.java:383)
at java.applet.Applet.getAudioClip(Applet.java:329)
at java.applet.Applet.getAudioClip(Applet.java:349)
at com.design.init(design.java:20)
at sun.applet.AppletPanel.run(AppletPanel.java:434)
at java.lang.Thread.run(Thread.java:745)
I guess the problem might be in the installation of JMF....but i don`t know exactly where i am wrong.
Please someone tell the exact method to run JMF in eclipse.