Applet not Working.Why???

I have written an applet program but it does not work
It works when i did it as an application.
I have installed JAVA plug in.The HTML and Applet codes
are in the same directory as JDK
The web browser comes up with a grey area & the following messages:
Exception:java.lang.ClassNotFoundException:testing4.class
(on the grey area)
Applet testing4 not loaded (at the bottom of the browser)
Why is this so?
The code i have used are as follows:
HTML CODE
<html>
<title>LPC
</title>
<applet code="testing4.class"  width=400 height=110>
</applet>
</html>APPLET PROGRAM CODE
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
//import java.lang.Object;
public class testing4 extends JApplet
{ private JTextArea display;
  private JScrollPane scrollPane2;
  private JButton paste;
  private JPanel P2;
  private File fileName;
  public void init()
    paste=new JButton("paste");
    paste.setMinimumSize(new Dimension(90,20));
    paste.setPreferredSize(new Dimension(90,20));
    paste.setMaximumSize(new Dimension(90,20));
    copyhandler pa=new copyhandler();
    paste.addActionListener(pa);
    display=new JTextArea();
    scrollPane2=new JScrollPane(display);
    scrollPane2.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane2.setMinimumSize(new Dimension(200,58));
    scrollPane2.setPreferredSize(new Dimension(200,58));
    scrollPane2.setMaximumSize(new Dimension(200,58));
    P2=new JPanel();
    P2.setMinimumSize(new Dimension(200,80));
    P2.setPreferredSize(new Dimension(200,80));
    P2.setMaximumSize(new Dimension(200,80));
    P2.setLayout(new BoxLayout(P2,BoxLayout.Y_AXIS));
    scrollPane2.setAlignmentX (Component.LEFT_ALIGNMENT);
    P2.add(scrollPane2);
    paste.setAlignmentX(Component.LEFT_ALIGNMENT);
    P2.add(paste);
   Container c=getContentPane();
    c.add(P2);
   //COPIES TEXT FROM FILE ON MY DISK TO THE TEXTAREA
   private class copyhandler implements ActionListener
   { public void actionPerformed(ActionEvent event)
     { JFileChooser fileChooser = new JFileChooser();
       fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY );
       int result = fileChooser.showOpenDialog(testing4.this);
       // user clicked Cancel button on dialog
       if ( result == JFileChooser.CANCEL_OPTION )
         return;
       fileName = fileChooser.getSelectedFile();
       if ( fileName == null ||
          fileName.getName().equals( "" ) )
       JOptionPane.showMessageDialog( null,"Invalid File Name",
                                        "Invalid File Name",
                                      JOptionPane.ERROR_MESSAGE );
       else
       { try
         { FileReader in = new FileReader(fileName);
           BufferedReader reading= new BufferedReader(in);
           String store="";
           while (reading.ready())
           { StringTokenizer st = new StringTokenizer(reading.readLine());
             store=store+st.nextToken()+"\n";
           display.setText(store);
         catch ( IOException e )
         { JOptionPane.showMessageDialog( null,
                                      "Error Opening File", "Error",
                                      JOptionPane.ERROR_MESSAGE );
  public static void main (String [] args)
  { testing4 done =new testing4();
    JFrame frame = new JFrame("testing");
    frame.addWindowListener(new WindowAdapter()
                             public void windowClosing(WindowEvent e)
                               System.exit(0);
    done.init();
    frame.getContentPane().add(done);
    frame.pack();
    frame.setSize(205,110);
    frame.setVisible(true);
}

It Still giving a blank page.
New Code
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
//import java.lang.Object;
public class testing4 extends JApplet
{ private JTextArea display;
  private JScrollPane scrollPane2;
  private JButton paste;
  private JPanel P2;
  private File fileName;
  public void init()
    paste=new JButton("paste");
    paste.setMinimumSize(new Dimension(90,20));
    paste.setPreferredSize(new Dimension(90,20));
    paste.setMaximumSize(new Dimension(90,20));
    copyhandler pa=new copyhandler();
    paste.addActionListener(pa);
    display=new JTextArea();
    scrollPane2=new JScrollPane(display);
    scrollPane2.setVerticalScrollBarPolicy(
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane2.setMinimumSize(new Dimension(200,58));
    scrollPane2.setPreferredSize(new Dimension(200,58));
    scrollPane2.setMaximumSize(new Dimension(200,58));
    P2=new JPanel();
    P2.setMinimumSize(new Dimension(200,80));
    P2.setPreferredSize(new Dimension(200,80));
    P2.setMaximumSize(new Dimension(200,80));
    P2.setLayout(new BoxLayout(P2,BoxLayout.Y_AXIS));
    scrollPane2.setAlignmentX (Component.LEFT_ALIGNMENT);
    P2.add(scrollPane2);
    paste.setAlignmentX(Component.LEFT_ALIGNMENT);
    P2.add(paste);
   Container c=getContentPane();
    c.add(P2);
   //COPIES TEXT FROM FILE ON MY DISK TO THE TEXTAREA
   private class copyhandler implements ActionListener
   { public void actionPerformed(ActionEvent event)
     { JFileChooser fileChooser = new JFileChooser();
       fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY );
       int result = fileChooser.showOpenDialog(testing4.this);
       // user clicked Cancel button on dialog
       if ( result == JFileChooser.CANCEL_OPTION )
         return;
       fileName = fileChooser.getSelectedFile();
       if ( fileName == null ||
          fileName.getName().equals( "" ) )
       JOptionPane.showMessageDialog( null,"Invalid File Name",
                                        "Invalid File Name",
                                      JOptionPane.ERROR_MESSAGE );
       else
       { try
         { FileReader in = new FileReader(fileName);
           BufferedReader reading= new BufferedReader(in);
           String store="";
           while (reading.ready())
           { StringTokenizer st = new StringTokenizer(reading.readLine());
             store=store+st.nextToken()+"\n";
           display.setText(store);
         catch ( IOException e )
         { JOptionPane.showMessageDialog( null,
                                      "Error Opening File", "Error",
                                      JOptionPane.ERROR_MESSAGE );
  public static void main (String [] args)
  { testing4 done =new testing4();
    //you did not set applet's width and height:
    //applet is a container too
    done.setWidth(205);
    done.setHeight(110);
    JFrame frame = new JFrame("testing");
    frame.addWindowListener(new WindowAdapter()
                              public void windowClosing(WindowEvent e)
                              { System.exit(0);
    done.init();
    frame.getContentPane().add(done);
    frame.pack();
    frame.setSize(205,110);
    frame.setVisible(true);
}

Similar Messages

  • My ipad camera is not working why? Help

    My ipad camera is not working, why? Please help!!

    HI Judejesalva,
      You can restore your ipad to your factory settings it could be that the camera is having an error with the camera software.

  • Java applet not working savevid keepvid

    Hi all,
    I'm sure I'm not the only one who has been confounded by Java applets not working in certain download web services; in my case, keepvid.com and savevid.com to download copies of youtube videos.  It has been a huge headache and even debilitating in my case.  I teach film and video to middle schoolers, and we often use youtube as a resource for our class projects. 
    I found a solution today, I think, and wanted to share it:
    I installed the browser called "Torch" and it seems to work fine, so far.

    thanx 4 replying
    using the browser to view Applet is not recomended that is because if u change the the source-code and recompile the applet then run it using the broswer it will run the old-version
    Also i've found the solution here
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html

  • Hello, I just did an update and now the second Language - Hebrew - does not working. why?

    Hello, I just did an update and now the second Language - Hebrew - does not working. why?

    More information please.
    If you are on adobe cloud, download indesign that support hebrew from CC desktop. Click on the preference gear on the top right then select App language.

  • HT2731 i already make my apple id but it not working why?

    sir i make id but not working why?

    What happens when you try to use it ? When you create an account you should get a email which you will need to open and click on the 'verify now' link in it.
    If it's a different problem ... ?

  • I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?

    I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?

    Well the error message is in Swedish but says: The installation program database is damaged. Please contact the Adobe support (which is a hard thing to do!!). I use Windows 7 Home Premium with service pack 1.
    Från: Mylenium 
    Skickat: den 29 december 2014 16:48
    Till: Tony Bohman
    Ämne:  I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?
    I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?
    created by Mylenium <https://forums.adobe.com/people/Mylenium>  in Downloading, Installing, Setting Up - View the full discussion <https://forums.adobe.com/message/7050595#7050595>

  • My network is not working i am in ghana and i use MTN  network but it is not working why is it like that

    my network is not working i am in ghana and i use MTN  network but it is not working why is it like that... pls get back to me now

    It sounds as if you need to call your mobile carrier.

  • I just bought a brand new iphone 5c and the home button is not working , why is that ?

    I just had a brand new iPhone 5c and the home button is not working , why is that ?

    then contact apple for warranty support or return the phone

  • I have iPhone 4S with new ios7, and panorama wallpaper doesn't work ! It let me shoose it, but it's not work, why?

    I have iPhone 4S with new ios7, and panorama wallpaper doesn't work ! It let me shoose it, but it's not work, why?

    These prices are for the U.S.
    Out-of-Warranty Service
    If you own an iPhone that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will service your iPhone for the Out-of-Warranty Service fee listed below.
    iPhone model          Out-of-Warranty Service
    iPhone 5          $229
    iPhone 4S          $199
    iPhone 4, iPhone 3GS,
    iPhone 3G, Original iPhone          $149
    A $6.95 shipping fee will be added if service is arranged through Apple and requires shipping. All fees are in U.S. dollars and are subject to local tax.
    When setting up out-of-warranty service, Apple will request credit card pre-authorization for the maximum service fee listed above.  This amount will be deducted from your credit limit. The final service fee we charge will be determined during testing and may be less than the service fee listed above.
    Certain damage is ineligible for out-of-warranty service, including catastrophic damage, such as the device separating into multiple pieces, and inoperability caused by unauthorized modifications. However, an iPhone that has failed due to contact with liquid may be eligible for out-of-warranty service.
    Apple reserves the right to determine whether or not your iPhone is eligible for Out-of-Warranty service. iPhones that are repaired or replaced have a 90-day limited hardware warranty or assume the remainder of your standard warranty or AppleCare service contract coverage, whichever is longer. Please see Apple's Repair Terms And Conditions for further details.

  • The Restriction option to NOT ALLOW CHANGES to Mobile or Cellular data does not work why is this ?

    The Restriction option to NOT ALLOW CHANGES to Mobile or Cellular data does not work why is this ?

    Hi there,
    You may want to try force closing all open apps and resetting the device as an initial troubleshooting step. Take a look at the articles below for more information.
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Turn your iOS device off and on (restart) and reset
    http://support.apple.com/kb/ht1430
    Additionally, you may want to try completely disabling and re-enabling restrictions.
    -Griff W.

  • My new iPhone 4S speaker not working why?

    my iPhone 4S iOS 7.0.3,model MF266HN/A,8GB one speaker not working why? What can I do?

    All iPhones are mono. Stereo is only available on Earphones.
    Bottom left is mic and right is the speaker.

  • I have downloaded skype, but after synchronizing with itunes skype not working, why?

    i have downloaded skype, but after synchronizing with itunes skype not working, why?  when I was synchronizing I believe there was some message in itune saying software not backed up or somethin to that effect.

    Thanks for your response.
    However, I did not find any solution to my problem.
    in my phone the skype application skype is not opening up, same is the caseiwth mobile voip. Both these applications were downloaded last night and it worked then, but not working now.
    Thanks in advance for anyone willing to help. I am new to the iphone.

  • Installing Java 7 from Oracle just made Applets not work, how to fix

    Mac 10.7.4. I tried installing Java 7 from Oracle, but all it did was remove half the prefs from Java and make Applets not work. How do I revert/reinstall Java?

    Here you go!
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Preview applet not working

    I'm experimenting with Java applets and DW and have run into
    a puzzling problem. I have a simple applet that involves one file
    (.class). The applet code is located in the root of my local test
    directory. I've created an html file in DW that contains nothing
    but the single applet. Since the applet is located in the same
    directory as the html file, there is no codebase in the applet tag.
    If I try to preview this html file, which invokes the applet, in
    DW, I see a gray box that is the right size, but the applet does
    not run. If I open this html file in an external instance of IE
    (not through DW preview), the applet runs fine. I'm using IE7.0.
    Anyone know why previewing in IE through DW should behave so
    differently?

    tripap wrote:
    > I mean preview in browser--same as using F12 or other
    key combination that
    > invokes that function. What's odd is that I have one
    extremely simple Java
    > applet (Welcome to Java) that works, but the one that
    won't work does some
    > actual math and includes a method, but still only
    produces one code file.
    > There's some reason the slightly more complex applet
    will not work properly in
    > DW preview, but works fine running in an external
    browser.
    All Dreamweaver is doing is opening the selected page in a
    browser, so from the browser's point of view there is (should be )
    no difference.
    Are you previewing using temp pages by chance? (Edit ->
    Preferences -> Preview in Browser -> Preview using temporary
    file)
    Are you using a web server to access the pages from the
    browser directly (as in
    http://localhost/folder/myfile.htm
    ) but within Dreamweaver it opens up as:
    file:///C|users/username/folder/site/myfile.html ?
    From here, I think that you'd need to post a link to your
    page (and a link to the Java applet so taht someone can see if
    there is some issue going on when the page is local.
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Admin Applets not working

    Hi ,
    i installed content server 11.1.1.3 on windows7 32 bit on oracle using rcu 11.1.1.3. The admin applets were working fine just after installation. But later i re-installed oracle database, created schemas with rcu 11.1.1.4, and updated java version to 1.6.0_21 from 1.6.0_18. Now the admin applets are not working. Instead of applet link i am getting Text with large font and links are not working. Can you please tell what is the possible reason.
    thanks

    Hi fscherpe,
    Thanks for reply. I installed the java plugin 1.6.0_26 in mozilla and applets are working fine now. But i am surprised why it was not working for update 26 ad-ons in IE however now its working fine in IE as well.
    Thanks

Maybe you are looking for

  • Creation of SDEB's instead of Purchase requisitions while running Plant MRP

    Hi Gurus, we noticed that after the weekend run of MRP that the system has produced SDEB''s rather than Purchase requisitions. When we run individual MRP for a part then a purchase requisition is created and if run an MRP total region requisitions ar

  • SAP  R/3 and BW integration Landscape

    Hello Gurus, Could you'll suggest a site or link where I could get a better insight into the SAP  R/3 and BW integration Landscape, i.e. how Data gets transferred from SAP R/3 to BW. Thanks, Sebastian

  • AAE - Error -  Unable to retrieve MappingInterfaceLocalHome from JNDI while

    Hi Friends, We have an interface which runs in AAE.  (Advanced Adapter Engine, PI 7.1, EHP1) Sender is SOAP, Async Call. We have used the condition to determine receiver. One Receiver is SOAP (by remove proxy) and another one receiver is RFC. When we

  • Ipod touch youtube HELP!!!

    The youtube app on my ipod touch doesn't work so i can't watch any youtube videos. I updated my OS to 4 and it still does not work. It says 'you are not authorized to play this file' and won't play the video. I have registered with itunes account. Th

  • Displaying custom graph in ALV report

    Hi Can you tell me how to display a custom graph for a column in a alv report. That is adding a seperate button in the report and display a graph for a column when the button is clicked. If 'Graph_2d' function module is used can anybody tell how to p