Re: class can't be instantiated/ applet not initialized error

I would change the following:
From:
public abstract class AmazingApplet extends JApplet implements ActionListener
to:
public class AmazingApplet extends JApplet implements ActionListener
Also, since your class implements ActionListener, you must have an actionPerformed method (to take care of the addActionListener that you used all over the place.
V.V.

Thanks Viravan,
When I remove "abstract", I get the following error message:
AmazingApplet.java:7: AmazingApplet should be declared abstract; it does not define actionPerformed(java.awt.event.ActionEvent) in AmazingApplet
public class AmazingApplet extends JApplet implements ActionListener
Also, I do have actionPerfomed method in the program. Any suggestions?

Similar Messages

  • "applet not initialized " error message  HELP !

    My applet compiles ok but when I try to run it at the bottom of the screen it says
    start : "applet not initialized"
    note - it works ok compiling from the Window console and then opening
    the .html file in the browser, but when I try the same applet in the
    BlueJ IDE ....that is when I get an error message.
    Thank you in advance
    import java.awt.*;
    import objectdraw.*;
    //A program that produces an animation of the rising and setting sun
    //The animation is driven by dragging the mouse
    public class ScrollingSun extends WindowController
    private FilledOval sun; // circle that represents the sun
    //Place the sun and some brief instructions on the screen
    public void begin()
    sun = new FilledOval(100,150,100,100,canvas);
    sun.setColor(Color.yellow);
    new Text("Drag the mouse up or down", 20,20,canvas);
    //Move the sun to follow the mouse's vertical motion
    public void onMouseDrag(Location mousePosition)
    sun.moveTo(100,mousePosition.getY() );
    <html>
    <head>
    <title> ScrollingSun
    </title>
    <body>
    <applet
    archive = "objectdraw.jar"
    codeBase = "."
    code = "ScrollingSun.class" width = 800 height = 800 >
    </applet>
    </body>
    </html>

    I put a start() around the begin() method
    and a public void init() method around the onMouseDrag() method
    but I am getting an "illegal start of expression" error message
    Thank you for your advice
    import java.awt.*;
    import objectdraw.*;
    //A program that produces an animation of the rising and setting sun
    //The animation is driven by dragging the mouse
    public class ScrollingSun extends WindowController
       private FilledOval sun;   // circle that represents the sun
      public void start()
          //Place the sun and some brief instructions on the screen
          public void begin()
             sun = new FilledOval(100,150,100,100,canvas);
             sun.setColor(Color.yellow);
             new Text("Drag the mouse up or down", 20,20,canvas);
       public void init()
           //Move the sun to follow the mouse's vertical motion
           public void onMouseDrag(Location mousePosition)
             sun.moveTo(100,mousePosition.getY() );
    }

  • Applet not initialized, when I uninstall JRE1.4.1_24 on Win NT 4.0

    We have uninstalled JRE1.4.1_24 from Win NT4.0 system and installed JRE1.3.1_08. Applet not initialized error coming up when the broser tries to open applet. Please help.

    The Windows Java uninstall doesn't do a good job cleaning up after itself.
    I ended up having to reinstall JRE1.4 to getting it working again.
    Eugenio

  • Error with signed applet "class can't be instantiated"

    hi,
    I developed an applet to make a ftp connexion to upload files from the local disk and the applet is already signed. At first I compiled it with the 1.4 version and I got (from other computers) the error "class not found". Then I used the target 1.1 option and now I get the error "class can't be instantiated"
    Do I need any additional code?
    I am using all these imports
    import java.applet.Applet;
    import java.applet.AppletContext;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.JComponent;
    import javax.swing.JProgressBar;
    import javax.swing.*;
    Thanks

    go to
    Tools->Internet Options->Advanced
    Look for "Java (Sun)" (normally near Microsoft VM). I uncheck all the Microsoft VM options but am not sure if that is really necessary.
    Also play with Control Panel, you should see "Java Plug-in" in there and be able to configure browsers a bit with that.

  • Load: AcidRainApplet.class can't be instantiated

    The error "load: AcidRainApplet.class can't be instantiated" is coming up on this bit of code, any ideas on being rid of it?
    // The "AcidRainApplet" class.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Date;
    import javax.swing.*;
    public class AcidRainApplet extends Applet implements KeyListener, ActionListener
      public AcidRainApplet ()
        super ();
      int width = 600, height = 450;
      int x = width / 2, y = height - 100, w = 27, h = 40;
      int count = 0;
      boolean playing = true, pause = true;
      Font endFont = new Font ("Arial Black", Font.PLAIN, 36);
      Font ptFont = new Font ("Westminster", Font.PLAIN, 28);
      int points = 0;
      int numRain = 80;
      int maxRain = 200;
      int speed = 5;
      ImageIcon imgi = new ImageIcon ("homer.gif");
      Image ch = imgi.getImage ();
      javax.swing.Timer t;
      public void init ()
        setBackground (Color.black);
        t = new javax.swing.Timer (speed, this);
        this.addKeyListener (this);
        for (int i = 0 ; i < maxRain ; i++)
          rain = new Rain ();
    } // init method
    public void paint (Graphics g)
    super.paint (g);
    g.setColor (Color.white);
    g.drawString ("" + numRain, width - 20, 15);
    if (playing)
    g.drawImage (ch, x, y, null);
    g.setColor (Color.green);
    for (int i = 0 ; i < numRain ; i++)
    g.drawLine (rain [i].x, rain [i].y, rain [i].x, rain [i].y - 10);
    if (!(pause))
    rain [i].y += rain [i].sp;
    if (rain [i].y > height)
    rain [i].x = (int) (Math.random () * width);
    rain [i].y = 0;
    rain [i].sp = (int) (Math.random () * 5) + 2;
    points++;
    else if (rain [i].x >= x && rain [i].x <= x + w && rain [i].y >= y && rain [i].y <= y + h)
    playing = false;
    else
    g.drawString ("PRESS ENTER TO PLAY AGAIN", 180, 400);
    g.setFont (endFont);
    g.setColor (Color.red);
    g.drawString ("GAME OVER", 150, 200);
    g.setFont (ptFont);
    g.setColor (Color.green);
    g.drawString ("Score: " + points, 200, 300);
    t.stop ();
    if (pause)
    g.setColor (Color.green);
    g.drawString ("PRESS ENTER", 200, 200);
    } // paint method
    public void resetVars ()
    x = width / 2;
    y = height - 100;
    count = 0;
    playing = true;
    pause = true;
    points = 0;
    maxRain = 200;
    speed = 5;
    for (int i = 0 ; i < maxRain ; i++)
    rain [i] = new Rain ();
    public class Rain extends Applet
    Rain ()
    int x = (int) (Math.random () * width);
    int y = 0;
    int sp = (int) (Math.random () * 5) + 2;
    Rain rain [] = new Rain [maxRain];
    public void actionPerformed (ActionEvent e)
    repaint ();
    public void keyTyped (KeyEvent k)
    public void keyPressed (KeyEvent k)
    int key = k.getKeyCode ();
    if (!(pause))
    if (key == k.VK_LEFT && x > 0)
    x -= 5;
    if (key == k.VK_RIGHT && x + w < width)
    x += 5;
    if (key == k.VK_DOWN && numRain > 10)
    numRain -= 10;
    repaint ();
    if (key == k.VK_UP && numRain != maxRain)
    numRain += 10;
    repaint ();
    if (key == k.VK_ENTER)
    if (pause)
    pause = false;
    t.start ();
    else if (!(playing))
    resetVars ();
    else
    pause = true;
    t.stop ();
    public void keyReleased (KeyEvent k)
    } // AcidRainApplet class

    Irrespective of the working of your program, I would suggest you remove a lot of weeds and clean the code. That would help you do easier debugging .
    Somethings I can quickly tell are,
    the constructor in AcidRainApplet not useful, Rain implementing Applet not useful, implements KeyListener, ActionListener can be delegated to another class, usage of inner class can be rethinked of delegation can be given a thought. Following code can be thought of :
      class Rain
        private  int x = 0;
        private int y = 0;
        private int sp = 0;
        Rain ()
          reset();
        public int getX() {
          return x;
        public int getY() {
          return y;
        public void setX(int x) {
          this.x = x;
        public void setY(int y) {
          this.y = y;
         public void reset() {
          x = (int) (Math.random () * width);
          y = 0;
          sp = (int) (Math.random () * 5) + 2;   
      }Good wishes,
    Rajesh

  • "Class can't be instantiated " error message. Help !

    Dear Java People,
    In trying to do a program that outputs a sound with every button click
    I have no compilation errors but a runtime error that says:
    "class can't be instantiated"
    below is the program and below that the error message
    thank you in advance
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public abstract class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1;
         AudioClip acSound_2;
         AudioClip acSound_3;
         AudioClip acSound_4;
         AudioClip acSound_5;
         AudioClip acSound_6;
         AudioClip acSound_7;
         AudioClip acSound_8;
         AudioClip acSound_9;
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
            try
             acSound_1 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_2 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_3 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_4 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_5 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_6 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_7 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_8 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_9 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             catch (MalformedURLException e)
               System.out.println("Error here " );
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
    java.lang.InstantiationException
         at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    load: stan_my_music_applet_1.MyMusicApplet_1.class can't be instantiated.
         at java.lang.Class.newInstance0(Class.java:306)
         at java.lang.Class.newInstance(Class.java:259)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
         at sun.applet.AppletPanel.run(AppletPanel.java:292)
         at java.lang.Thread.run(Thread.java:536)

    I also tried:
    try
    for(int a=0;a<8;a++)
    {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (i + 1) + ".wrk")));
    and the error message still says:
    "MyMusicApplet3.java": Error #: 300 : method getAudioClip(java.net.URL, java.net.URL) not found in class stan_my_music_applet_3.MyMusicApplet3 at line 19
    Help !
    below is the revised code
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public class MyMusicApplet3 extends JApplet implements ActionListener
      AudioClip[] acSounds= new AudioClip[9];
      public void init()
       try
            for(int a=0;a<8;a++)
            {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (a + 1) + ".wrk")));
      catch (Exception e)
        System.out.println("Error here " );
            Container myContentPane = getContentPane();
            myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            myContentPane.add(getButton("1", Color.orange));
            myContentPane.add(getButton("2", Color.blue));
            myContentPane.add(getButton("3", Color.cyan));
            myContentPane.add(getButton("4", Color.pink));
            myContentPane.add(getButton("5", Color.red));
            myContentPane.add(getButton("6", Color.pink));
            myContentPane.add(getButton("7", Color.cyan));
            myContentPane.add(getButton("8", Color.yellow));
            myContentPane.add(getButton("9", Color.blue));
        public void actionPerformed(ActionEvent e)
           String command = e.getActionCommand();
           int index = Integer.parseInt(command)-1;
           acSounds[index].play();
       public JButton getButton(String label, Color fore)
         {          JButton button = new JButton("sound "+label);
                    button.setPreferredSize(new Dimension(190,100));
                    button.setFont(new Font("Arial", Font.BOLD,14));
                    button.setBorder(BorderFactory.createRaisedBevelBorder());
                    button.setForeground(fore);
                    button.setBackground(Color.orange);
                    button.addActionListener(this);
                    button.setActionCommand(label);
                    return button;
          }//"MyMusicApplet3.java": Error #: 300 :
    //method getAudioClip(java.net.URL, java.net.URL) not found in class
    // stan_my_music_applet_3.MyMusicApplet3 at line 19, column 24

  • Class can't be instantiated

    Hi guys
    Just having trouble running this applet for some reason, in any browser. Other applets are working at the minute, so it doesn't look like a prob with the browsers or JVM.
    Heres the code, followed by the error message.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public abstract class ColourButtons extends Applet
                                              implements ActionListener, MouseListener
         private Button colorButtons[] = new Button[7];
        private Color color = Color.black;
         int x1, y1, x2, y2 = 1;
        public void init()
              setLayout(new BorderLayout(20,20));
              Panel pWest = new Panel();
              pWest.setLayout(new GridLayout(7,1));
              for(int x =0; x <= 6; x++)
                   colorButtons[x] = new Button("   ");
                   pWest.add(colorButtons[x]);
                   add("West",pWest);
                   //add actionlisteners for each button
                   colorButtons[x].addActionListener(this);
                   if(x == 0){
                        color = Color.red;}
                   else if( x==1){
                        color = Color.blue;}
                   else if(x==2){
                        color = Color.green;}
                   else if(x==3){
                        color = Color.yellow;}
                   else if(x==4){
                        color = Color.orange;}
                   else if(x==5){
                        color = Color.black;}
                   else if(x==6){
                        color = Color.white;}
                   colorButtons[x].setBackground(color);
            setBackground(Color.gray);
        public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(color);
              //create Rectangle Object
              Rectangle myRectangle = new Rectangle(x1,y1,x2,y2);
              g2.draw(myRectangle);
                       g2.drawString("HELLO", 150,100);
        public void actionPerformed(ActionEvent a)
            Button button = (Button)a.getSource();
            color = button.getBackground();
            repaint();
        public void mouseClicked(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mousePressed(MouseEvent e)
              x1 = e.getX();
              y1 = e.getY();
        public void mouseReleased(MouseEvent e)
              x2 = e.getX();
              y2 = e.getY();
    }And heres the error message.
    load: ColourButtons.class can't be instantiated.
    java.lang.InstantiationException
    at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance
    (InstantiationExceptionConstructorAccessorImpl.java:30)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
    at sun.applet.AppletPanel.run(AppletPanel.java:292)
    at java.lang.Thread.run(Thread.java:536)
    Any ideas at what is wrong?
    Any help/pointers greatly appreciated
    Cheers

    ok cheers thats sorted it. For some reason it wanted it to be abstract once i added mouse listener i think.
    Anyway cheers

  • First please read this- applet not initialized

    I read forums topic which is relational with applet errors but I couldnt solve my problem.
    I developed a program with php and mysql.there isnt any printing library for php under linux.so I am using an applet for printing.I could use javascript but I dont want to show printer dialog so I chose java applet.in my htdocs directory I put class file and all other php files are there too.when I want to run this php file which has inside applet tag it shows me "applet not initialized".so can you help me for this?that applet works on my pc but in server it didnt work.what is wrong with server or apache?I set up j2sdk to server too but I couldnt solve this problem something wrong with apache maybe it cant find the class file or do I have to recognize java files to apache like php?
    it is really important for me.if you can help I ll be glad.thanks for all

    I developed a program with php and mysql.in php file I am using applet tag to print out some informations.when I connected from client to the server.in that page I cant run applet.in client browser I have java plugin too.if I tried applets and also this print applet in my laptop it is working but if I put them into the server and if I connect from client applet isnt working problem is this.please someone help me

  • Chat applet not initialized???

    OS X on iMac...try to log in yahoo Chat but I get an error message " applet not initialized " I check every HELP suggestion but none will do nor does it properly address the issue. How does one initialize applet? Some say uninstall Java then re-install but OS X doesn't allow me to uninstall JAVA which came preinstalled. The funny thing is that the bottom portion of the yahoo chat site works but the chat area is blank.
    Can anyone help? .Mac support guys are useless they only want money! they will not offer any assistance until a payment is made. Even then they can't guarantee anything. can anyone help me? I want to CHAT ON YAHOO.
    David no say in yahoo.

    Example settings for chat, based on Safari browser:
    In Safari, select Preferences > Security > Web Content. Make sure the three check boxes pertaining to Java - "Enable Plugins", "Enable Java" and "Enable JavaScript" are active.
    Some web chat providers also require that you install their client software.
    Having never used such services, I do not know if this applies to Yahoo, or if they provide suitable client software for Mac OS X users.

  • Start:applet not initilaized error

    Hi friends,
    I'm getting Start:applet not initilaized error when i'm running a program...
    saved a notepad file as Testloan.java used javac Testloan.java and appletviewer Testloan.java to execute the applet here is my code...
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    <html>
    <applet code="Testloan.class" width=300 height=100>
    </applet>
    </html>
    public class Testloan extends Applet implements ActionListener
    TextField t1,t2,t3;
    Label lp,lr,lmp;
    Button b1,b2;
         public void init()
         lp=new Label("Principal");
         lr=new Label("Rate");
         lmp=new Label("Payment");
         add(lp);
         add(lr);
         add(lmp);
         t1=new TextField();
         add(t1);
         t2=new TextField();
         add(t2);
         t3=new TextField();
         add(t3);
         b1=new Button("submit");
         add(b1);
         b1=new Button("Exit");
         add(b2);
         b1.addActionListener(this);
    b2.addActionListener(this);
    public void start() {
    //win.setVisible(true);
    public void stop() {
    //win.setVisible(false);
    public static int months(int principal,double rate,int payment)
              Testloan tl=new Testloan();
              principal=Integer.parseInt(tl.t1.getText());
              rate=Double.parseDouble(tl.t2.getText());
              payment=Integer.parseInt(tl.t3.getText());
              int p=principal;
              double eRate = rate / 1200.0;
              int month =0,np=1;
                   while(np>0)
                   month = month + 1;
                   np= (int) (p*(1+eRate)-payment );
                   System.out.println(np+"/n");
                   p = np;
              return month;
    public void actionPerformed(ActionEvent e)
    String cmd = e.getActionCommand();
    }

    First, the code you posted was mangled by the forum formatting software. When you post code, select it and click the CODE button above the typing area, which will prevent that, and maintain your formatting.
    When you ran the appletviewer program from the cmd window, error information was posted to it by the java command. Did you look at it? It says that you have a NullPointerException at this line
    add(b2);because there's a typo in this line
    b1 = new Button("Exit");which should have assigned a value to b2, not b1
    Read and understand the error messages that java creates, they almost always point exactly at the problem and allow you to debug the cause.

  • 'CRT not initialized' error after installing MS Office 2010

    Hi,
    I encountered 'CRT not initialized error' after installing MS Office 2010. I think that with previous version of CVI there were no problems. But, with Labwindows/CVI 2012 error has outbroken. The details are as follows.
    - OS : windows 7 Enterprise (32bit)
    - Labwindows/CVI (v12.0.0 (422))
    - MS Office 2010 (word, powerpoint, excel)
    #1. clean install windows 7 (32 bit)
    #2. install Labwindows/CVI v12.0.0 and device drivers (DAQ, Motion)
    #3. compile and run attached test program : SUCCESS
    #4. online update windows 7 (service pack, explorer 9, and etc)
    #5. compile and run attached test program : SUCCESS
    #6. install MS Office 2010
    #7. compile and run attached test program : 'CRT error'
    #8. uninstall MS Office 2010
    #9. compile and run attached test program : SUCCESS
    I think there are some conflicts between office 2010 and labwindows v12.0.0. How can I solve this problem?
    Thank you in advance.
    Attachments:
    step7-CRT error.jpg ‏31 KB
    test program.zip ‏3305 KB

    More specifically, I decided that some parts of MS Office files and features of NI's motion library conflicts. Because in the attacted sample program, if I exclude NI-Motion functions then the program excutes nicely. But if I include NI-Motion fucntion, for example flex_select_signal, then the 'CRT not initialized' error occurs.
    To solve this problem I tried step by step installation check for MS Office 2010. During each step I included more optional features in MS Office and after each installation I compiled and executed my sample program. At finally, I found that the addtional part of MS Office 2010, if I install Office Sharing Function>Microsoft IME(Korean), then the 'CRT not initialized' error occurs.
    Temporarly, I solved the problem with NOT installing 'Office Sharing Function>Microsoft IME(Korean)' optional feature in the MS Office 2010.
    Could you tell me why this problem occur?

  • Abstract Class can't be instantiated

    Hi I'm getting the following error messages while compiling. Does any one have any idea how to get RID of it?
    ERROR MESSAGES:
    EditableHeaderTableExample2.java:48: inner class EditableHeaderTableExample2. MyComboRenderer is an abstract class. It can't be instantiated.
    MyComboRenderer renderer = new MyComboRenderer(items);
    ^
    EditableHeaderTableExample2.java:79: Method redefined with different return type: javax.swing.table.TableCellRenderer getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) was java.awt.Component getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
    public TableCellRenderer getTableCellRendererComponent(
    ^
    2 errors
    Here is the code:
    EditableHeaderTableExample2.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.JComponent;
    import javax.swing.JComboBox;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    import javax.swing.JTable;
    import javax.swing.plaf.metal.*;
    import javax.swing.JFrame;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableColumnModel;
    import javax.swing.DefaultCellEditor;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.DefaultTableCellRenderer;
    public class EditableHeaderTableExample2 extends JFrame {
    public static void main(String[] args) {
    EditableHeaderTableExample2 frame = new EditableHeaderTableExample2();
    frame.setSize(400,300);
         frame.setLocation(100,100);
         frame.setVisible(true);
    public EditableHeaderTableExample2(){
    JTable table = new JTable(10,10);
    TableColumnModel columnModel = table.getColumnModel();
    table.setTableHeader(new EditableHeader(columnModel));
    String[] items = {"Dog","Cat"};
    JComboBox combo = new JComboBox();
    for (int i=0;i<items.length;i++) {
    combo.addItem(items);
    MyComboRenderer renderer = new MyComboRenderer(items);
    EditableHeaderTableColumn col;
    // column 1
    col = (EditableHeaderTableColumn)table.getColumnModel().getColumn(1);
    col.setHeaderValue(combo.getItemAt(0));
    col.setHeaderRenderer(renderer);
    col.setHeaderEditor(new DefaultCellEditor(combo));
    // column 3
    col = (EditableHeaderTableColumn)table.getColumnModel().getColumn(3);
    col.setHeaderValue(combo.getItemAt(0));
    //col.setHeaderRenderer(renderer);
    col.setHeaderEditor(new DefaultCellEditor(combo));
    JScrollPane pane = new JScrollPane(table);
    getContentPane().add(pane);
    class MyComboRenderer extends JComboBox implements TableCellRenderer
    MyComboRenderer(String[] items) {
    for (int i=0;i<items.length;i++) {
    addItem(items[i]);
    public TableCellRenderer getTableCellRendererComponent(
    JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column) {
    setSelectedItem(value);
    return this;

    This is not a suggestion, it's a requirement. When you say
    class MyComboRenderer extends JComboBox implements TableCellRendererthe "implements TableCellRenderer" part is a promise that your class will include a method whose signature is
        Component getTableCellRendererComponent(JTable table, Object value,
                                 boolean isSelected, boolean hasFocus,
                                 int row, int column);

  • Discoverer 4i Plus Applet not initializing Win2k/IE6 - Solution

    Hi,
    I finally got a solution to the problem of the Discoverer 4i Plus Applet not launching on IE 6.0 Windows2000 machines.
    When you click on the image "Click to Start" the area goes grey and the applet never comes up. When you look at the java console you will notice a class not found exception. The reasons are as follows :
    - IE 6.0 doesn't come with a built in JVM unlike the earlier versions. The JVM resides with the OS i.e. Windows2000 or WindowsXP.
    - When launching the Discoverer applet you need to invoke the appropriate htm page
    e.g. http://serverURL/discwb4/html/english/ms_ie/start_ie.htm
    This htm page doesn't have any hint in the <applet> tag to use jinitiator or any other JVM to launch the applet, assuming that since the IE browser has an embedded JVM the applet will be launched. However this fails to happen since IE6.0 which ships with Window200 and Windows XP doesn't have a built in JVM. Why the JVM in the OS doen't take of that I don't know as yet. Therefore the applet fails to load and you get a class not found exception that can be verified thru the browser's java console.
    - So instead of calling the IE configured page start_ie.htm call the corresponding netscape page like http://serverURL/discwb4/html/english/netscape/start_nn.htm. The start_nn.htm page has the appropriate <embed> tags to hint the initialization of the applet using jinitiator or other JVM. Therefore the applet gets launched.
    Hope this helps all those who have had to face this issue.
    Kiron

    Hi Simon
    (4) Can I take the user automatically to the list of database workbooks ("Open Workbook from Database" dialogue box) without the user having to choose "Open an existing workbook" and "Database"?
    Yes user can automatically view the workbooks or the worksheet or even a particular page of the worksheet.
    Give the URL to the user and ask the user to run the URL from his/her browser. The URL shloud however contain the username, password, database name, workbook name etc...
    This way we can bypass all the login screens and go directly to the desired page.
    URL is as follows
    http://hostname.domain/program_name/?us=APPS&db=devl&wb=Wb3&pw=apps
    where
    hostname.domain/program_name is where ur discoverer viewer is residing
    us is the username
    pw is the password
    db is the database u wnat to connect to
    wb is the workbook u want to open
    Try this , this works.
    Ankit

  • Start: Applet not initialized!!!

    need help... can't seem to run the applet program
    <HTML>
    <HEAD>
    <TITLE>CyberPet Applet</TITLE>
    </HEAD>
    <BODY>
    <p>
    <applet code="CyberPetApplet.class" width=300 height=150>
    </applet>
    </p>
    </BODY>
    </HTML>C:\Program Files\jbuilder5\jdk1.3\bin\javaw -classpath "D:\java\CyberPet\classes;C:\Program Files\jbuilder5\jdk1.3\demo\jfc\Java2D\Java2Demo.jar;C:\Program Files\jbuilder5\jdk1.3\jre\lib\i18n.jar;C:\Program Files\jbuilder5\jdk1.3\jre\lib\jaws.jar;C:\Program Files\jbuilder5\jdk1.3\jre\lib\rt.jar;C:\Program Files\jbuilder5\jdk1.3\jre\lib\sunrsasign.jar;C:\Program Files\jbuilder5\jdk1.3\lib\dt.jar;C:\Program Files\jbuilder5\jdk1.3\lib\tools.jar" -Djava.security.policy="C:/Documents and Settings/Ayen/.jbuilder5/appletviewer.policy" sun.applet.AppletViewer File:///"D:/java/CyberPet/classes/cyberpet/CyberPet.html"
    java.lang.NoClassDefFoundError: CyberPetApplet (wrong name: cyberpet/CyberPetApplet)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:142)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:108)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:366)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
         at sun.applet.AppletPanel.run(AppletPanel.java:293)
         at java.lang.Thread.run(Thread.java:484)

    i tried putting the html file in the same
    CyberPetApplet.class directory, but it doesnt
    work.....You have to do one of the following.
    1) Put your applet in a jar. Then you can put the jar in the same directory as your html page (or whereever you want to put it really). (This is the preferred method).
    2) You'll have to put the class file in the right directory structure based on your package structure relative to your html file.
    So in the directory with your html file you would have a directory named cyberpet with your applet class inside.

  • I can't fix the "Server Not Found" error

    Ok, when I started up Firefox I was greated with a "Server not found" error, so I thougt to myself, " Ok, I'll just follow the instructions shown". Didn't help, still didn't work. So I dcided to use Internet Explorer until the issue fixed itself, didn't work. So I tried the 64 bit version, that worked. So basically what I'm trying to ask is: is there a 64 bit version to Firefox, or is another solution what i need?

    Close all of your anti-virus software and restart your FF.
    Also see [http://www.yanfei.info/2011/07/firefox-link-error solution of connection was reset] for more help .

Maybe you are looking for

  • How can I use external clock to implement a delay?

    Hi all,   I am testing to use external clock to drive dev/PFI0 (on device 6711) which is used as the clock for the analog ouput. I have thinking two applications by using the external clock but I don't have much idea on the implementation yet. First

  • Background image instead of color for each sliding panel

    I'm working with sliding panels and trying to add some style to the page.  I have figured out how to put a different background color on each slide and even how to put a background image on the whole thing, but  I cannot figure out how to use multipl

  • Web Service in java HELP!!!!

    Hi everyone, i'm new in web services and i have to make a web service in java that it will accept an xml file from a client. The client will have to connect with the server in a particular port and ,through the web service, the client will have to se

  • Cfdocument pdf rendering problem

    When you create a PDF using cfdocument, the <I> </I> tag and <B> </B> tag renders incorrectly sometimes. When it's at the edge of the table, the text inside the tags is repeated twice. And sometimes, it truncates the space or spaces before the tag. O

  • Hello world servlet in Glassfish. Need help to start, please.

    Hello. I am new to servlet technology. I am reading the Servlet specification 2.4 and I want to try everything on practice. I want to start using the Glassfish. Currently I want to try it as a simple servlet container. A few years ago I used to work