Results 1 to 7 of 7
  1. #1
    rasikh is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default Java applet problem

    hi
    i developed a java Applet component to integrate with my website using Netbeans ,which record audio and previews and then save file.
    my problem is this component works fine when i compile it using netbeans.it opens up in java applet viewer and works perfectly fine. but when i embed this component in html. it just shows the GUI component and dont perform any functionality.
    plz let me know what are the possible reasons . and how can i overcome this.

    this is my complete code.

    Java Code:
    import java.awt.Container;
    import java.awt.GridBagLayout;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.InputStream;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.sound.sampled.AudioFileFormat;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.TargetDataLine;
    import javax.swing.*;
    
    public class AudioRecoder extends JApplet {
    
        public void init() {
         initComponents();
         recButton.setEnabled(true);
         stopButton.setEnabled(false);
         previewButton.setEnabled(false);
         doneButton.setEnabled(false);
         Container content = getContentPane();
         content.setLayout(new GridBagLayout()); // Used to center the panel
         content.add(panel);
        }
    
           // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
    
            panel = new javax.swing.JPanel();
            recButton = new javax.swing.JButton();
            stopButton = new javax.swing.JButton();
            previewButton = new javax.swing.JButton();
            doneButton = new javax.swing.JButton();
            cancelButton = new javax.swing.JButton();
    
            recButton.setText("REC");
            recButton.setToolTipText("Click here to Start Recording your voice From Microphone");
            recButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    recButtonActionPerformed(evt);
                }
            });
    
            stopButton.setText("Stop");
            stopButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    stopButtonActionPerformed(evt);
                }
            });
    
            previewButton.setText("Preview");
            previewButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    previewButtonActionPerformed(evt);
                }
            });
    
            doneButton.setText("Done");
            doneButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    doneButtonActionPerformed(evt);
                }
            });
    
            cancelButton.setText("Cancel");
            cancelButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cancelButtonActionPerformed(evt);
                }
            });
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(panel);
            panel.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(73, 73, 73)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(recButton)
                        .addComponent(doneButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(stopButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(previewButton))
                        .addGroup(layout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(cancelButton)))
                    .addGap(140, 140, 140))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(stopButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(recButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addComponent(previewButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGap(62, 62, 62)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cancelButton)
                        .addComponent(doneButton))
                    .addGap(79, 79, 79))
            );
        }// </editor-fold>
    
        private void recButtonActionPerformed(java.awt.event.ActionEvent evt) {
            recButton.setEnabled(false);
            stopButton.setEnabled(true);
            previewButton.setEnabled(false);
            doneButton.setEnabled(false);
    
            captureAudio();
        }
    
        private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {
            recButton.setEnabled(true);
            stopButton.setEnabled(false);
            previewButton.setEnabled(true);
            doneButton.setEnabled(true);
            stopCapture = true;
    
    
         //   targetDataLine.stop();
         //   targetDataLine.close();
    
        }
    
        private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
            System.exit(0);
        }
    
        private void previewButtonActionPerformed(java.awt.event.ActionEvent evt) {
            playAudio();        // TODO add your handling code here:
        }
    
        private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {
            try {
                      AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
                      File audioFile = new File("abc.wav");
                      byte audioData[] = byteArrayOutputStream.toByteArray();
                      InputStream byteArrayInputStream = new ByteArrayInputStream(audioData);
                            AudioFormat audioFormat =
                          getAudioFormat();
          audioInputStream =
            new AudioInputStream(
              byteArrayInputStream,
              audioFormat,
              audioData.length/audioFormat.
                           getFrameSize());
    
    
          AudioSystem.write(audioInputStream ,fileType,audioFile);
    
            } catch (Exception ex) {
              ex.toString();
            }
    
        }
    
          private void playAudio() {
        try{
          //Get everything set up for
          // playback.
          //Get the previously-saved data
          // into a byte array object.
          byte audioData[] =
                     byteArrayOutputStream.
                             toByteArray();
          //Get an input stream on the
          // byte array containing the data
          InputStream byteArrayInputStream
                = new ByteArrayInputStream(
                                audioData);
          AudioFormat audioFormat =
                          getAudioFormat();
          audioInputStream =
            new AudioInputStream(
              byteArrayInputStream,
              audioFormat,
              audioData.length/audioFormat.
                           getFrameSize());
          DataLine.Info dataLineInfo =
                    new DataLine.Info(
                      SourceDataLine.class,
                              audioFormat);
          sourceDataLine = (SourceDataLine)
                       AudioSystem.getLine(
                             dataLineInfo);
          sourceDataLine.open(audioFormat);
          sourceDataLine.start();
    
          //Create a thread to play back
          // the data and start it
          // running.  It will run until
          // all the data has been played
          // back.
          Thread playThread =
              new Thread(new PlayThread());
          playThread.start();
        } catch (Exception e) {
          System.out.println(e);
          System.exit(0);
        }//end catch
      }//end playAudio
    
        private AudioFormat getAudioFormat(){
             float sampleRate = 8000.0F;
        //8000,11025,16000,22050,44100
        int sampleSizeInBits = 16;
        //8,16
        int channels = 1;
        //1,2
        boolean signed = true;
        //true,false
        boolean bigEndian = false;
        //true,false
        return new AudioFormat(sampleRate,
                               sampleSizeInBits,
                               channels,
                               signed,
                               bigEndian);
        }
    
        private void captureAudio(){
         try{
          //Get everything set up for
          // capture
          audioFormat = getAudioFormat();
          DataLine.Info dataLineInfo =
                    new DataLine.Info(
                      TargetDataLine.class,
                       audioFormat);
          targetDataLine = (TargetDataLine)
                       AudioSystem.getLine(
                             dataLineInfo);
          targetDataLine.open(audioFormat);
          targetDataLine.start();
    
          //Create a thread to capture the
          // microphone data and start it
          // running.  It will run until
          // the Stop button is clicked.
          Thread captureThread =
                    new Thread(
                      new CaptureThread());
          captureThread.start();
        } catch (Exception e) {
          System.out.println(e);
          System.exit(0);
        }//end catch
    
       }
        public class CaptureThread extends Thread{
             byte tempBuffer[] = new byte[10000];
    
         public void run(){
                byteArrayOutputStream =
               new ByteArrayOutputStream();
        stopCapture = false;
        try{//Loop until stopCapture is set
            // by another thread that
            // services the Stop button.
          while(!stopCapture){
            //Read data from the internal
            // buffer of the data line.
            int cnt = targetDataLine.read(
                        tempBuffer,
                        0,
                        tempBuffer.length);
            if(cnt > 0){
              //Save data in output stream
              // object.
              byteArrayOutputStream.write(
                       tempBuffer, 0, cnt);
            }//end if
          }//end while
          byteArrayOutputStream.close();
        }catch (Exception e) {
          System.out.println(e);
          System.exit(0);
        }//end catch
       }
    }
    
       class PlayThread extends Thread{
      byte tempBuffer[] = new byte[10000];
    
      public void run(){
        try{
          int cnt;
          //Keep looping until the input
          // read method returns -1 for
          // empty stream.
          while((cnt = audioInputStream.
            read(tempBuffer, 0,
                tempBuffer.length)) != -1){
            if(cnt > 0){
              //Write data to the internal
              // buffer of the data line
              // where it will be delivered
              // to the speaker.
              sourceDataLine.write(
                       tempBuffer, 0, cnt);
            }//end if
          }//end while
          //Block and wait for internal
          // buffer of the data line to
          // empty.
          sourceDataLine.drain();
          sourceDataLine.close();
        }catch (Exception e) {
          System.out.println(e);
          System.exit(0);
        }//end catch
    
      }//end run
    }//end inner class PlayThread
    
    
        private boolean stopCapture = false;
        private boolean previewStoped=false;
        private AudioFormat audioFormat;
        private SourceDataLine sourceDataLine;
        private TargetDataLine targetDataLine;
        private AudioInputStream audioInputStream;
        private ByteArrayOutputStream byteArrayOutputStream;
    
        // Variables declaration - do not modify
        private javax.swing.JPanel panel;
        private javax.swing.JButton cancelButton;
        private javax.swing.JButton doneButton;
        private javax.swing.JButton previewButton;
        private javax.swing.JButton recButton;
        private javax.swing.JButton stopButton;
        // End of variables declaration
    
    
    }

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    830
    Rep Power
    6

    Default

    Do this and try once

    If you are running Netscape, click the menu item "Edit", then "Preferences". A screen will be displayed with different catagories. Click on "Advanced". You want to make sure the "Enable Java" box is checked.

    If you are running Internet Explorer, click on "Tools", then "Internet Options...". Click on the "Security" tab. Click on the button "Custom Level...". Scroll down the list of security settings until you find "Java: Java permissions". Make sure that java is not disabled, and that the security is not too high (I don't think it has to be very low to work).
    Ramya:cool:

  3. #3
    rasikh is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    it didnt help me.i have tried.
    Last edited by rasikh; 10-06-2009 at 01:00 PM.

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    830
    Rep Power
    6

    Default

    Goto ControlPanel and then goto Java console .In that goto advanced tab and check show console and see what is logging as a reason when u start the applet
    Ramya:cool:

  5. #5
    rasikh is offline Member
    Join Date
    Oct 2009
    Posts
    5
    Rep Power
    0

    Default

    Following is what i get from java console.its throwing hundreds of exception.can u plz tell me the possible reason.and how can i solve this problem. One more thing i want to ask is i have three classes in my code.but in html code i only reference one file. is it the cause of my problem ??


    Java Code:
    Java Plug-in 1.6.0_15
    Using JRE version 1.6.0_15-b03 Java HotSpot(TM) Client VM
    User home directory = D:\Users\B r A t
    ----------------------------------------------------
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.captureAudio(AudioRecorder.java:199)
     at AudioRecorder.access$400(AudioRecorder.java:17)
     at AudioRecorder$1.actionPerformed(AudioRecorder.java:56)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.NullPointerException
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.playAudio(AudioRecorder.java:152)
     at AudioRecorder.access$500(AudioRecorder.java:17)
     at AudioRecorder$3.actionPerformed(AudioRecorder.java:72)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.captureAudio(AudioRecorder.java:199)
     at AudioRecorder.access$400(AudioRecorder.java:17)
     at AudioRecorder$1.actionPerformed(AudioRecorder.java:56)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.NullPointerException
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.playAudio(AudioRecorder.java:152)
     at AudioRecorder.access$500(AudioRecorder.java:17)
     at AudioRecorder$3.actionPerformed(AudioRecorder.java:72)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.captureAudio(AudioRecorder.java:199)
     at AudioRecorder.access$400(AudioRecorder.java:17)
     at AudioRecorder$1.actionPerformed(AudioRecorder.java:56)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.lang.NullPointerException
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.playAudio(AudioRecorder.java:152)
     at AudioRecorder.access$500(AudioRecorder.java:17)
     at AudioRecorder$3.actionPerformed(AudioRecorder.java:72)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.captureAudio(AudioRecorder.java:199)
     at AudioRecorder.access$400(AudioRecorder.java:17)
     at AudioRecorder$1.actionPerformed(AudioRecorder.java:56)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkExit(Unknown Source)
     at java.lang.Runtime.exit(Unknown Source)
     at java.lang.System.exit(Unknown Source)
     at AudioRecorder.captureAudio(AudioRecorder.java:199)
     at AudioRecorder.access$400(AudioRecorder.java:17)
     at AudioRecorder$1.actionPerformed(AudioRecorder.java:56)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
    Last edited by rasikh; 10-06-2009 at 09:04 PM.

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Applets are not allowed to do certain stuff because they run on the browser and are capable of being very naughty if allowed certain access. Either sign it or don't use Applets at all.

  7. #7
    haylem is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Re: Java applet problem

    Old thread, but will reply anyway for those who'd hit the same wall...

    Quote Originally Posted by r035198x View Post
    Applets are not allowed to do certain stuff because they run on the browser and are capable of being very naughty if allowed certain access. Either sign it or don't use Applets at all.
    Signing the applet won't have any effect on this particular issue, or at least not with additional local changes to the Java Security Policy (I have tried, as I had the same issue).

    But your first sentence is correct: the issue comes from the attempted use of unauthorized capabilities, in particular of the calls to `System.exit()`.

    See this SO answer for a more detailed explanation.

Similar Threads

  1. Problem launching Java applet
    By jacatone in forum Java Applets
    Replies: 3
    Last Post: 01-19-2009, 11:56 PM
  2. java applet button problem .. :( plz help!
    By i4gotmyid in forum Java Applets
    Replies: 1
    Last Post: 04-17-2008, 04:11 PM
  3. java applet button problem .. :( plz help
    By i4gotmyid in forum New To Java
    Replies: 0
    Last Post: 04-05-2008, 09:55 AM
  4. Java Applet re-creation problem
    By Mikalai.Kardash in forum Java Applets
    Replies: 0
    Last Post: 07-23-2007, 02:09 PM
  5. Problem with run Java Applet
    By Albert in forum Java Applets
    Replies: 1
    Last Post: 07-13-2007, 03:06 PM

Posting Permissions

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