Results 1 to 3 of 3

Thread: lil' error

  1. #1
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

    Default lil' error

    When I run my applet I get:
    Java Code:
    Reading certificates from 1768 http://streetwars.comuf.com/StreetWars.jar | /home/deividas/.java/deployment/cache/6.0/14/301a4f8e-4fb2caec.idx
    java.lang.reflect.InvocationTargetException
    	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(DeployAWTUtil.java:116)
    	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Plugin2Manager.java:3336)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2905)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassCastException: start cannot be cast to java.applet.Applet
    	at sun.plugin2.applet.Plugin2Manager$12.run(Plugin2Manager.java:2895)
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Exception: java.lang.reflect.InvocationTargetException
    java.lang.NullPointerException
    	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Plugin2Manager.java:2996)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2947)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Exception: java.lang.NullPointerException
    java.lang.InterruptedException: sleep interrupted
    	at java.lang.Thread.sleep(Native Method)
    	at org.jvnet.lafwidget.animation.FadeTracker$FadeTrackerThread.run(FadeTracker.java:199)
    java.lang.reflect.InvocationTargetException
    	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(DeployAWTUtil.java:116)
    	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Plugin2Manager.java:3336)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2905)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassCastException: start cannot be cast to java.applet.Applet
    	at sun.plugin2.applet.Plugin2Manager$12.run(Plugin2Manager.java:2895)
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Exception: java.lang.reflect.InvocationTargetException
    java.lang.NullPointerException
    	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Plugin2Manager.java:2996)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2947)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Exception: java.lang.NullPointerException
    java.lang.reflect.InvocationTargetException
    	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(DeployAWTUtil.java:116)
    	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Plugin2Manager.java:3336)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2905)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassCastException: start cannot be cast to java.applet.Applet
    	at sun.plugin2.applet.Plugin2Manager$12.run(Plugin2Manager.java:2895)
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Exception: java.lang.reflect.InvocationTargetException
    java.lang.NullPointerException
    	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Plugin2Manager.java:2996)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2947)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397)
    	at java.lang.Thread.run(Thread.java:619)
    Exception: java.lang.NullPointerException
    My class:
    Java Code:
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.net.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.*;
    import org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel;
    
    /**
     *
     * @author deividas
     */
    public class start extends JPanel {
    
    
    
        boolean loggedIn = false;
    
        public static void main(String[] args) {
            java.awt.EventQueue.invokeLater(new Runnable() {
    
                public void run() {
                    createAndShowUI();
                }
            });
        }
    
        public start() {
    
            UIManager UIManager = new UIManager();
            try {
                UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(start.class.getName()).log(Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                Logger.getLogger(start.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(start.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedLookAndFeelException ex) {
                Logger.getLogger(start.class.getName()).log(Level.SEVERE, null, ex);
            }
    
            setPreferredSize(new Dimension(955, 605));
            setLayout(new BorderLayout());
            //----PANELS----//
    
            //top panel
            JPanel topPanel = new JPanel(new GridLayout(1, 0, 5, 5));
            topPanel.setOpaque(false);
            add(topPanel, BorderLayout.NORTH);
            //panel1
            JPanel panel1 = new JPanel(new GridLayout(1, 0, 5, 5));
            panel1.setOpaque(false);
            JLabel welcomeL = new JLabel("<html><br><br><br><br><br><br>Welcome to Street Wars.</html>");
            panel1.add(welcomeL);
            //---END OF PANELS---//
    
            //---TABS---//
    
            //tab1
            JTabbedPane tabbedPane = new JTabbedPane();
            tabbedPane.addTab("Welcome", panel1);
            tabbedPane.setMnemonicAt(0, KeyEvent.VK_F1);
            topPanel.add(tabbedPane);
        }
    
        private static void createAndShowUI() {
    
    
            JFrame frame = new JFrame("Street Wars");
            frame.getContentPane().add(new start());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            frame.setResizable(false);
            start start = new start();
            frame.setJMenuBar(start.createMenuBar());
    
        }
    
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
    
            URL url = this.getClass().getResource("/images/background.jpg");
            Image img = Toolkit.getDefaultToolkit().getImage(url);
    
            g.drawImage(img, 0, 0, this);
        }
    
        //menubar
        public JMenuBar createMenuBar() {
    
            JMenuBar menuBar;
            JMenu menu;
            final JMenuItem loginItem;
            final JMenuItem registerItem;
            final JMenuItem logoutItem;
    
            //Create the menu bar.
            menuBar = new JMenuBar();
            menuBar.setOpaque(true);
            //Build the first menu.
            menu = new JMenu("File");
            menuBar.add(menu);
    
            //a group of JMenuItems
    
            loginItem = new JMenuItem("Login");
            menu.add(loginItem);
            registerItem = new JMenuItem("Register");
            menu.add(registerItem);
            logoutItem = new JMenuItem("Logout");
            logoutItem.setVisible(false);
            menu.add(logoutItem);
            menu.addSeparator();
    
            loginItem.addActionListener(new ActionListener() {
    
                public void actionPerformed(ActionEvent e) {
                    if (loggedIn == false) {
                        JOptionPane.showMessageDialog(null, "loggedIn should be set to TRUE");
                        loggedIn = true;
                    }
    
                    if (loggedIn == true) {
                        JOptionPane.showMessageDialog(null, "loggedIn is " + loggedIn + ".");
                        loginItem.setVisible(false);
                        registerItem.setVisible(false);
                        logoutItem.setVisible(true);
                    }
                }
            });
    
            return menuBar;
        }
    }
    Last edited by PhQ; 03-23-2010 at 11:06 PM. Reason: Wrong error :D

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    put

    "Caused by: java.lang.ClassCastException: start cannot be cast to java.applet.Applet"

    into Google, and you'll be surprised how many people have problems with this...

  3. #3
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

Similar Threads

  1. Replies: 1
    Last Post: 03-10-2010, 01:53 PM
  2. Replies: 1
    Last Post: 12-05-2009, 07:28 AM
  3. Replies: 1
    Last Post: 10-26-2009, 04:38 PM
  4. Replies: 3
    Last Post: 01-23-2009, 08:53 AM
  5. error 530 error authentication required
    By rgale in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-12-2008, 04:28 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
  •