Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default ClassNotFoundException

    Programmed some 4 years ago and thing have changed...
    maybe the old applet tag does not work any more?
    any suggestions what might go wrong here?


    1) I've got the applet working at Netbeans (apple viewer)
    2) the jav contains two classes (generated with netbeans)
    2) use following html code:

    <BODY>*
    <P>*
    <applet code="FirstApplet.jav" width="1000" height="1000">
    Java applet
    </applet>*
    </BODY>

    3) get the following error message:


    cargar: clase FirstApplet.jar no encontrada.
    java.lang.ClassNotFoundException: FirstApplet.jar
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Ap plet2ClassLoader.java:252)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(P lugin2ClassLoader.java:249)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:179)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plu gin2ClassLoader.java:690)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plu gin2Manager.java:3045)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1497)
    at java.lang.Thread.run(Thread.java:680)
    Excepciůn: java.lang.ClassNotFoundException: FirstApplet.jar

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default Re: ClassNotFoundException

    java.lang.ClassNotFoundException: FirstApplet.jar
    Where is the class file for the class: FirstApplet.jar located? The java program can not find it.
    It is looking for the file: FirstApplet.jar.class


    <applet code="FirstApplet.jav" width="1000" height="1000">
    Is the posted html correct? The code= attribute should name the starting class. The class it refers to is very close but not the same as the class named in the error message.

    You should research the syntax for the applet tag to see what attributes to use and how to code them.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    wow, norm you are still around
    we spoke a lot some four years ago
    thanks for you reply I'll look into it

  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    yes both classes are there
    1) FirstApplet.class
    2) secondApplet.class
    plus the MANIFEST.MF

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default Re: ClassNotFoundException

    Did you:
    You should research the syntax for the applet tag to see what attributes to use and how to code them.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: ClassNotFoundException

    Quote Originally Posted by willemjav View Post
    wow, norm you are still around
    we spoke a lot some four years ago
    ...
    Old programmers never die. They just become deprecated. (with apologies to Norm who is likely close to me in age).

  7. #7
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    and since the tag is not CODEBASE but APPLET CODE and the jar is at the same dir as the HTML....
    thinks should work?
    they worked in the old days

  8. #8
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    there was this other guy called nick I believe?
    Is he still "there"

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: ClassNotFoundException

    I haven't seen Nicholas Jordan around for a couple of years, if that's who you're referring to.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  10. #10
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: ClassNotFoundException

    *rubs eyes*

    .jav?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  11. #11
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    yes that's the one
    (.jav?)?
    what you mean here

  12. #12
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    applet still not starting instead this gets displayed
    ¬ ¬ ¬ ¬ ¬ ¬ ¬

    Java frist applet ¬

    got the "right" tag from here


    Objects, Images, and Applets in HTML documents

    <OBJECT codetype="application/java"
    classid="myfirstapplet.jar"
    width="800" height="800">
    Java frist applet
    </OBJECT>

    difficult stuff

  13. #13
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    the jar is at the same dir as the html tag, right!
    what would codetype mean? (see above)

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default Re: ClassNotFoundException

    I'm not familiar with the object tag. I've always used the applet tag.
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    Both are not working for me, this stuff is as clear as mud, hahaha

  16. #16
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    here are both applet classes, maybe this helps
    I do not know what is going on here
    It is not really correct programming yet,
    but it works!


    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.Arrays;
    import java.awt.event.*;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    
    /**
     *
     * @author willem
     */
    public class FirstApplet extends JApplet
                                implements ActionListener, Runnable {
        private Thread runner1;  // multi thread
        private JButton b1, b2, b3, b4, b5;
        private JPanel p1, p2, p3, p4, p5, p6;
        private JLabel j1, j2, j3, j4;
        private TextArea t1, t2;
        private String s1, s2, s3;
        private JPasswordField pw;
        private static String OK = "ok";
        private JFrame frame;
    
        private URL ulr = null;
     //   private URL theURL = null;
        String urlLink = "http://www.google.com/";
        
        private JTextField textField;
        private JOptionPane optionPane;
       
        
    
        secondApplet drawW = new secondApplet();
        
       
        public void init() {
    
            //WindowUtilities.setNativeLookAndFeel();
            s1 = "Dear Alfonso this is my first test program over the net. \n"
                    + "It looks simple but it is not easy to make! \n"
                    + "-first enter your pass word = the dog's name \n"
                    + "-second press start and do 7 mouse clicks on the \n"
                    + "second screen after the 7 clicks push the second button \n"
                    + "and finaly push exit to finish \n ";
            s2 = "for securitie reasons please \n"
                    + "type in creditcard number \n "
                    + "and get your prize";
    
            Container content1 = getContentPane();
            content1.setBackground(Color.white);
           // Container infowindow = getContentPane();
          //  infowindow.setBackground(Color.white);
    
            
            p1 = new JPanel();
            p2 = new JPanel();
            p3 = new JPanel();
            j1 = new JLabel("enter password in min");
            j2 = new JLabel("");
            b1 = new JButton("animation");
            b2 = new JButton(" PRIZE ");
            b3 = new JButton("exit");
            
    
            t1 = new TextArea(s1,7,38);
            pw = new JPasswordField("xxxxxxxxxx", 10);
    
            content1.setLayout (new BorderLayout());    //(new GridLayout(3,1))
            p1.setLayout(new FlowLayout());
            p2.setLayout(new FlowLayout());
            p3.setLayout(new FlowLayout());
    
            content1.add(p1, BorderLayout.NORTH);
            content1.add(p2, BorderLayout.CENTER);
            content1.add(p3, BorderLayout.SOUTH);
            p1.add(b1);
            p1.add(b2);
            p1.add(b3);
            p2.add(t1);
            p3.add(j1);
            p3.add(pw);
            p3.add(j2);
    
            b1.addActionListener(this);
            b2.addActionListener(this);
            b3.addActionListener(this);
            pw.setActionCommand(OK);
            pw.addActionListener(this);
    
            // third window
            frame = new JFrame("Infowindo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container contentPane = frame.getContentPane();
            contentPane.setLayout(new BorderLayout());
    
            
            frame.setLocation(drawW.wsz[0],drawW.wsz[1]);
    
            frame.setSize(450,200);
    
        //    magicWord = aWord.toUpperCase();
         //   setTitle("Quiz");
    
            p4 = new JPanel();
            p5 = new JPanel();
            p6 = new JPanel();
            t2 = new TextArea(s2,3,30);
            j4 = new JLabel("creditcard numb");
            b4 = new JButton("chancel");
            b5 = new JButton("ok");
    
            textField = new JTextField(15);
    
    
            contentPane.setLayout(new BorderLayout());
            p4.setLayout(new FlowLayout());
            p5.setLayout(new FlowLayout());
            
            contentPane.add(p4, BorderLayout.NORTH);
            contentPane.add(p5, BorderLayout.CENTER);
            contentPane.add(p6, BorderLayout.SOUTH);
    
            p4.add(t2);
            p5.add(j4);
            p5.add(textField);
            p6.add(b4);
            p6.add(b5);
    
            b4.addActionListener(this);
            b5.addActionListener(this);
    
            
            
         //   frame.setAlwaysOnTop(true);
            
            System.out.println("FIRST APPLET CONSTRUCTOR (init)");    
        }
    
    
        public void actionPerformed (ActionEvent e) {
            String cmd = e.getActionCommand();
            if (e.getSource()==b1) {
                System.out.println("first button pressed " );
    
                drawW.cleanScreen();
                drawW.start2thread();  // animation      
            }
            
            if (e.getSource()==b2) {  
    	System.out.println("second button pressed " );
                if (drawW.setPrizebutton()){
                    System.out.println("win a prize " );
                  //  drawW.cleanScreen();
                    drawW.setVisible(false);
                    frame.setVisible(true);
                }
            }
            
            if (e.getSource()==b3) {
    	System.out.println("third button pressed " );
                stop();
                destroy();
            }
    
            if (e.getSource()==b4) {
    	System.out.println("chancel button pressed " );
                stop();
                destroy();
            }
    
            if (e.getSource()==b5) {
    	System.out.println("ok button pressed " );
               //drawW.cleanScreen();
                frame.setVisible(false);
                drawW.setVisible(false);
                
                    if (ulr != null)  {
                            try { this.ulr = new URL(urlLink); }
                                catch ( MalformedURLException msg)  {
                                System.out.println("Bad URL: " + urlLink);
                                }
                            getAppletContext().showDocument(ulr);
                            System.out.println(" open URL ");
                    }
            }
    
    
    
            if (OK.equals(cmd)) { //Process the password.
                char[] input = pw.getPassword();
                if (isPasswordCorrect(input)) {
                    j2.setText("correct");
                    pw.setText("");
                    drawW.setVisible(true); // opens second window
                } else {                    // mouse clicks first
                j2.setText("not correct");
            }
                //Zero out the possible password, for security.
                Arrays.fill(input, '0');
    
                pw.selectAll();
                resetFocus();
            }
    
        }
        
        private static boolean isPasswordCorrect(char[] input) {
            boolean isCorrect = true;
            char[] correctPassword = { 'l', 'a', 'r', 'a' };
     
            if (input.length != correctPassword.length) {
                isCorrect = false;
            } else {
                isCorrect = Arrays.equals (input, correctPassword);
            }
            //Zero out the password.
            Arrays.fill(correctPassword,'0');
     
            return isCorrect;
        }
        
        protected void resetFocus() {
            pw.requestFocusInWindow();
        }
    
        
         public void run() {
             System.out.println("start run1 ");
            
         }
    
    
        public void start() {
            if (runner1 == null); {
                runner1 = new Thread(this);
                runner1.start();
                System.out.println("thread running ");
                
            }
            
        }
    
    
        public void stop() {
            if (runner1 != null) {
                runner1.stop();
                runner1 = null;
                System.out.println("1 thread stopped " );
                
            }
            drawW.stop2thread();
            destroy();
        }
    
        public void destroy() { // cleans up
        System.out.println("bye bye applet " );
        System.exit(0);
        }   
    }

    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /**
     *
     * @author willem
     */
    import java.awt.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.MouseEvent;
    import javax.swing.*;
    import java.awt.event.MouseListener;
    import java.awt.event.KeyListener;
    
        class secondApplet extends JFrame implements MouseListener,
                        KeyListener, Runnable  {
    
        private Thread runner;
        private int index, X, Y, K, ansize, size, hs, prize;
        private String tx1, tx2, tx3, tx4;
        private boolean textflag1, textflag2, textflag3, textflag0, cleens,
                drawfigflag, lottoflag, mouseclicksflag, lottotextflag,
                drawNumbersflag, drawLinesflag, winnerflag, prizebuttonflag, lottoloopflag;
        private Font f1, f2, f3;
    
    
        private int[] xpt;
        private int[] ypt;
        private int[] keys;
                int[] wsz;     //{400, 200, 800, 600};
        private boolean[] lotto;
        private int fig; // default circle
    
    
        secondApplet()  {
            //repaint();
            index = -1;
            prize = -1;
    
            textflag1 = false;
            textflag2 = false;
            textflag3 = false;
            textflag0 = true;
            cleens = false;
            drawfigflag = true;
            lottoflag = false;
            mouseclicksflag = true;
            drawNumbersflag = false;
            drawLinesflag = false;
            winnerflag = false;
            lottotextflag = false;
            lottoloopflag = false;
            xpt = new int[7];
            ypt = new int[7];
            keys = new int[7];
            wsz = new int[4];
            wsz[0]  = 400;
            wsz[1]  = 200;
            wsz[2]  = 800;
            wsz[3]  = 500;
            lotto = new boolean[6];
            size = 80;
            hs = size/2;
            ansize = size;
            fig = 2;
    
            tx1 = "start the animation and loto show";
            tx2 = "click on the animation button";
            tx3 = "than choose one of the balls to click on";
            tx4 = "and let see if you will win a prize";
    
            f1 = new Font("TimesRoman", Font.BOLD, 36);
            f2 = new Font("TimesRoman", Font.BOLD, 24);
            f3 = new Font("TimesRoman", Font.BOLD, 12);
    
            
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.pack();
            this.setLocation(wsz[0],wsz[1]);
            this.setSize(wsz[2],wsz[3]);
    
            this.setTitle(" clik mouse on this window  ");
            this.setAlwaysOnTop(true);
            this.addMouseListener(this);
            this.addKeyListener(this);
            System.out.println("SECOND APPLET CONSTRUCTOR");
        }
    
    
    
         void pause(int time) {
         try { Thread.sleep(time); }
         catch (InterruptedException e) {}
         }
    
    
        public void start2thread() {
            if (runner == null); {
                runner = new Thread(this);
                runner.start();
                System.out.println("second thread running ");
    
            }
        }
    
    
        public void stop2thread() {
            if (runner != null) {
                runner.stop();
                runner = null;
                System.out.println("second thread stopped " );
    
            }
        }
    
    
        public void mouseClicked(MouseEvent e) {
            //System.out.println("mouseClick x  "  + e.getX() + "y " + e.getY());
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
        public void mousePressed(MouseEvent e) {
            boolean wn = false;
            boolean ls = true;
            boolean gt = true;
            //cleanScreen();
            if (mouseclicksflag) { 
                
                setFig(e.getX(), e.getY()); // this set the figures
            }
            if (index >= 6 & mouseclicksflag) {
                mouseclicksflag = false; // close the two gstes
                lottotextflag = true;  //doLottotextflag
                start2thread();  // after setting figures start the loop
    
                System.out.println("done with the points animation flag true " );
                for (int i=0; i<7; i++)
                System.out.println("i " + i + " " + xpt[i] + "  " + ypt[i] );
            }
            
    
                if(lottoloopflag) {
                 cleanScreen();
             //   runner.suspend();
                lottoloopflag = false;
                gt = false;
                textflag3 = false;
                stop2thread();  // not good programming.... BUT IT OWRKS
                start2thread();            
                //  startFig(500);  //does not work
             //   drawLinesflag = true;
             //   drawNumbersflag = true;
                // pause(500);
                repaint();
            //    runner.resume();
                }
            
            if (lottoflag)  {
                int lotto = -1;
               
                for (int i=0; i<7; i++) {
                    if (setLotto(i, e.getX(), e.getY()))
                    lotto = i;
                    else  {
                    
                    }
                    if (prize == lotto) {
                        wn = true;
                        ls = false;
                    }
                    else  {
                        wn = false;
                        ls = true;
                    }
                }
    
    
                System.out.println(" winner is " + wn + " looser " + ls + " prize "
                    + prize + " lotto " + lotto);
                if (wn) {
                cleanScreen();
                textflag2 = true;
                textflag3 = false;
                winnerflag = true;
                prizebuttonflag = true;
               // mouseclicksflag = false;
                drawLinesflag = false;
                drawNumbersflag = false;
                stopFig();
                stop2thread();
                
                System.out.println(" there is a winner winner " + prize);
                repaint();
                removeMouseListener(this);
                }
    
                if (ls & gt) {
                cleanScreen();
                textflag3 = true;
                textflag2 = false;
                drawLinesflag = false;
                drawNumbersflag = false;
                stopFig();
                pause(1000);
                repaint();
             //   System.out.println(" a misser ");
                lottoloopflag = true;
                
                }
                gt = true;
                
                
    
            }
    
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
        public void mouseReleased(MouseEvent e) {
            //System.out.println("mouseUp x  "  + e.getX() + "y " + e.getY());
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
        public void mouseEntered(MouseEvent e) {
            //System.out.println("mouseEnter x  "  + e.getX() + "y " + e.getY());
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
        public void mouseExited(MouseEvent e) {
            //System.out.println("mouseExit x  "  + e.getX() + "y " + e.getY());
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
    
        public void keyTyped(KeyEvent ke) {
            //throw new UnsupportedOperationException("Not supported yet.");
            //System.out.println("Character: " + ke.getKeyCode());
    
        }
    
        public void keyReleased(KeyEvent ke) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    
        public void keyPressed(KeyEvent ke) {
            //throw new UnsupportedOperationException("Not supported yet.");
    
            if (ke.getKeyCode() == 83) { //squar
                fig = 2;
                System.out.println("Squar " + ke.getKeyCode());
            }
            else
                if (ke.getKeyCode() == 67) { //cicle
                fig = 2;
                System.out.println("Circle " + ke.getKeyCode());
            }
            else
                if (ke.getKeyCode() == 84) { //triangel
                fig = 2;
                System.out.println("Triangle " + ke.getKeyCode());
            }
        }
    
       
    
        public void run() {
             System.out.println("start second run ");
             if (lottotextflag)  {  //doLottotextflag
                lottotextflag = false; // close the gate
                prize = rand(7); // lotto prize
                  System.out.println(prize + " is de rand nummer");
                pause(3000);
                textflag1 = true;
                stopFig();
                repaint();
                stop2thread(); // waite for fist button and go to else
    
             }
             else {        // comtinuos the loop for animation
                  textflag1 = false;
                  startFig(500);
                  lottoflag = true; // for the lotto test loop
                  drawLinesflag = true;
                  drawNumbersflag = true;
                  while (true) {
                      pause (500);
                        index = -1;
                        for (int i=0; i<7; i++){
                        setFig(xpt[i], ypt[i]); // faster than startFig()
                        }
                 } // loop for lotto mouse clicks, lottoflag open
            }
         }
    
    
    
        void drawFig()   {
            for (int i=0; i<7; i++)  {
               Y = xpt[i];
               X = ypt[i];
               K = keys[i];
               repaint();
            }
        }
    
        boolean setLotto(int i, int x, int y)  {
            boolean b1 = false;
            boolean b2 = false;
    
            if (((x>(xpt[i])) & (x<(xpt[i]+size))))
               b1= true;
    
            if ((y>(ypt[i])) & (y<(ypt[i]+size)))
               b2= true;
    
            if (b1 & b2)  {
               b1 = true;
              // System.out.println(" setlotto index " + i + " " + b1);
            }
            else b1 = false;
    
            return b1;
        }
    
        boolean setPrizebutton()  {
            return prizebuttonflag;
        }
        
        void doIndex()  {
    
            if (index>=6) index =-1;
            index++;
    
        }
    
         void setFig(int x, int y)  {
            if (index<=5)  {
                doIndex();
                X = xpt[index] = x;
                Y = ypt[index] = y;
                K = keys[index] = fig; // store the keys pressed array
             //   System.out.println(index + " mouseDown x  "  + xpt[index]
              //                                  + " y " + ypt[index]);
                repaint();
            }
        }
    
        void startFig(int p)  {
            drawfigflag = true;
            index=-1;
                  for (int i=0; i<7; i++){
                        setFig(xpt[i], ypt[i]);
                        pause(p);
                     //   System.out.println(i + " figures  "  + xpt[i]
                     //     + " y " + ypt[i] + " size " + size + " key " + keys[i]);
                  }
        }
    
        void stopFig()  {
            drawfigflag = false;
        }
    
         
    
    
        int rand(int r)  {
            return (int)Math.floor(Math.random() * r);
        }
    
        void cleanScreen() {
            cleens = true;
            stopFig();
            textflag1 = false;
            textflag2 = false;
            textflag3 = false;
            repaint();
    
        }
    
        public void paint(Graphics g){
           // System.out.println(" FIRST PAINT IS CALLED index ");
              //draw on g here e.g.
            if (cleens) {
                g.setColor(Color.white);
                g.fillRect(0,0,wsz[2], wsz[3]);
                cleens = false;
              //  System.out.println(" paint cleens");
            }
            
            if (textflag0)  {
                     g.setColor(Color.white);
                     g.fillRect(0, 0, wsz[2], wsz[3]);
                     g.setColor(Color.black);
                     g.setFont(f3);
                     g.drawString("click slowly 7 time on the screen",10,40);
                     textflag0 = false;
    
            }
    
    
            if (textflag1) {       // random color set
    
                     g.setColor(Color.white);
                     g.fillRect(0, 0, wsz[2], wsz[3]);  
                     g.setColor(Color.green);
                     g.setFont(f1);
                     g.drawString(tx1,10,100);
                     g.setColor(Color.blue);
                     g.drawString(tx2,10,200);
                     g.setColor(Color.red);
                     g.drawString(tx3,10,300);
                     g.setColor(Color.black);
                     g.drawString(tx4,10,400);
                     textflag1 = false;
               }
            if (textflag2)  {
                
                   g.setColor(Color.white);
                   g.fillRect(0, 0, wsz[2], wsz[3]);
                   g.setColor(Color.red);
                   g.setFont(f2);
                   g.drawString("THERE IS A WINNER PRESS PRIZE BUTTON",10,100);
    
                }
            if (textflag3)  {
                   g.setColor(Color.white);
                   g.fillRect(0, 0, wsz[2], wsz[3]);
                   g.setColor(Color.red);
                   g.setFont(f2);
                   g.drawString("TRY AGAIN click on the screen" ,10,100);
                }
    
            
            if (drawfigflag) {
               // System.out.println(" set figures ");
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                     //  if (index != 0) {
                         switch (K) {  //keys[index]
                            case 1: g.fillRect(X, Y, ansize, ansize);
                            break;
                            case 2: g.fillOval(X, Y, ansize, ansize);
                            break;
                            case 3: {
                                int[] xPoints = {(100),(50),(150)};
                                int[] yPoints = {(100),(200),(200)};
                                Polygon poly = new Polygon(xPoints,yPoints,3);
                                poly.translate(X, Y);
                                g.fillPolygon(poly);
                            }
                            break;
                   }
            }
    
            if (drawLinesflag)  {
                    g.setFont(f2);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[0]+hs,ypt[0]+hs,xpt[1]+hs,ypt[1]+hs);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[1]+hs,ypt[1]+hs,xpt[2]+hs,ypt[2]+hs);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[2]+hs,ypt[2]+hs,xpt[3]+hs,ypt[3]+hs);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[3]+hs,ypt[3]+hs,xpt[4]+hs,ypt[4]+hs);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[4]+hs,ypt[4]+hs,xpt[5]+hs,ypt[5]+hs);
                    g.setColor(new Color(rand(256),rand(256),rand(256)));
                    g.drawLine(xpt[5]+hs,ypt[5]+hs,xpt[6]+hs,ypt[6]+hs);
    
            }
    
            if(drawNumbersflag) {
                for (int i=0; i<7; i++){
                g.setColor(Color.black);
                g.drawString("" + i ,xpt[i]+hs,ypt[i]+hs);
                }
            }
       }
    }

  17. #17
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default Re: ClassNotFoundException

    Where is the html to execute the applet? You need html to be able to execute an applet.
    If you don't understand my response, don't ignore it, ask a question.

  18. #18
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    here it is (at the same dir of the jar)
    <!DOCTYPE html>
    <HTML>*
    *<HEAD>*
    <TITLE>Hello!</TITLE>*
    </HEAD>*
    <BODY>*
    *
    <P>
    <OBJECT codetype="application/java"
    classid="java:myfirstapplet.jar"
    width="800" height="800">
    Java frist applet
    </OBJECT>
    </BODY>*
    </HTML>

  19. #19
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    so what is wrong with it norm?

  20. #20
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: ClassNotFoundException

    so the one before was

    <BODY>*
    <P>*
    <applet code="FirstApplet.jav" width="1000" height="1000">
    Java applet
    </applet>*
    </BODY>

Page 1 of 2 12 LastLast

Similar Threads

  1. ClassNotFoundException
    By naveen516 in forum Advanced Java
    Replies: 3
    Last Post: 12-13-2011, 01:15 PM
  2. ClassNotFoundException
    By gozuhair in forum New To Java
    Replies: 3
    Last Post: 11-24-2011, 11:54 PM
  3. ClassNotfoundException
    By shirleympearls in forum New To Java
    Replies: 4
    Last Post: 10-17-2011, 08:12 PM
  4. ClassNotFoundException!! Oh BOY!!
    By Joel in forum New To Java
    Replies: 13
    Last Post: 08-26-2011, 09:47 AM
  5. ClassNotFoundException
    By Chezelle in forum Java Applets
    Replies: 5
    Last Post: 12-24-2008, 04:26 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
  •