Problem with creating an applet

Discussion in 'Java' started by René Beltman, Dec 22, 2005.

  1. Hello everyone,

    For a test with applets I wanted to create an applet.

    The applet code:
    import javax.swing.*;
    import java.awt.*;

    public class ByeWorld extends JApplet {

    public void init() {
    Container contentPane = getContentPane();
    JLabel label = new JLabel("Goodbye world",SwingConstants.CENTER);
    contentPane.add(label);
    }
    }

    The HTML file:
    <html>
    <head>
    <title>Test</title>
    </head>

    <body>
    <applet code="ByeWorld.class" width="200" height="300"></applet><br />
    Hieronder staat een test met een applet
    </body>
    </html>

    At running of the applet I get the following exception:

    Exception in thread "Thread-6" java.lang.IllegalArgumentException
    at sun.net.www.ParseUtil.decode(Unknown Source)
    at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    at java.net.URL.openConnection(Unknown Source)
    at sun.applet.AppletPanel.getAccessControlContext(Unknown Source)
    at sun.applet.AppletPanel.getClassLoader(Unknown Source)
    at sun.applet.AppletPanel.createAppletThread(Unknown Source)
    at sun.applet.AppletPanel.init(Unknown Source)
    at sun.plugin.AppletViewer.createClassLoader(Unknown Source)
    at sun.plugin.AppletViewer.appletInit(Unknown Source)
    at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
    at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)

    Where the text Thread-6, the number vary's on the number of times I tried to
    access the webpage.
    ps. Mozilla is giving the exception:
    Exception in thread "Thread-2" java.lang.IllegalArgumentException
    at sun.net.www.ParseUtil.decode(Unknown Source)
    at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    at java.net.URL.openConnection(Unknown Source)
    at sun.applet.AppletPanel.getAccessControlContext(Unknown Source)
    at sun.applet.AppletPanel.getClassLoader(Unknown Source)
    at sun.applet.AppletPanel.createAppletThread(Unknown Source)
    at sun.applet.AppletPanel.init(Unknown Source)
    at sun.plugin.AppletViewer.createClassLoader(Unknown Source)
    at sun.plugin.AppletViewer.appletInit(Unknown Source)
    at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
    at sun.plugin.viewer.WNetscapePluginObject$Initer.run(Unknown Source)

    Does anyone know how to solve this problem? Thanks in advantage.

    Greetings,

    René Beltman.
     
    René Beltman, Dec 22, 2005
    #1
    1. Advertising

  2. René Beltman

    Danno Guest

    Given that you are suicidal, I don't think I want to help you solve it.
     
    Danno, Dec 22, 2005
    #2
    1. Advertising

  3. René Beltman

    Oliver Wong Guest

    "René Beltman" <> wrote in message
    news:dof2b7$alf$1.ov.home.nl...
    > Hello everyone,
    >
    > For a test with applets I wanted to create an applet.
    >
    > The applet code:
    > import javax.swing.*;
    > import java.awt.*;
    >
    > public class ByeWorld extends JApplet {
    >
    > public void init() {
    > Container contentPane = getContentPane();
    > JLabel label = new JLabel("Goodbye world",SwingConstants.CENTER);
    > contentPane.add(label);
    > }
    > }
    >

    [snip]
    >
    > Exception in thread "Thread-6" java.lang.IllegalArgumentException
    > at sun.net.www.ParseUtil.decode(Unknown Source)
    > at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    > at sun.net.www.protocol.file.Handler.openConnection(Unknown Source)
    > at java.net.URL.openConnection(Unknown Source)
    > at sun.applet.AppletPanel.getAccessControlContext(Unknown Source)
    > at sun.applet.AppletPanel.getClassLoader(Unknown Source)
    > at sun.applet.AppletPanel.createAppletThread(Unknown Source)
    > at sun.applet.AppletPanel.init(Unknown Source)
    > at sun.plugin.AppletViewer.createClassLoader(Unknown Source)
    > at sun.plugin.AppletViewer.appletInit(Unknown Source)
    > at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
    > at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)


    Did you try running it using the AppletViewer? I just did and it seems
    to run fine on my side.

    - Oliver
     
    Oliver Wong, Dec 22, 2005
    #3
  4. René Beltman

    zero Guest

    "René Beltman" <> wrote in
    news:dof2b7$alf$1.ov.home.nl:

    > Hello everyone,
    >
    > For a test with applets I wanted to create an applet.
    >
    > The applet code:
    > import javax.swing.*;
    > import java.awt.*;
    >
    > public class ByeWorld extends JApplet {
    >
    > public void init() {
    > Container contentPane = getContentPane();
    > JLabel label = new JLabel("Goodbye world",SwingConstants.CENTER);
    > contentPane.add(label);
    > }
    > }
    >
    > The HTML file:
    > <html>
    > <head>
    > <title>Test</title>
    > </head>
    >
    > <body>
    > <applet code="ByeWorld.class" width="200" height="300"></applet><br
    > /> Hieronder staat een test met een applet


    bedoel je niet hierboven? ;-)

    > </body>
    > </html>
    >
    > At running of the applet I get the following exception:
    >
    > Exception in thread "Thread-6" java.lang.IllegalArgumentException
    > at sun.net.www.ParseUtil.decode(Unknown Source)



    It looks like your classpath has an error. Check if all the directories in
    the classpath have valid names and exist.

    --
    Beware the False Authority Syndrome
     
    zero, Dec 23, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Love

    applet vs. canvas in applet

    Rob Love, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    657
    Liu, Chunyen
    Jul 7, 2003
  2. webster
    Replies:
    0
    Views:
    891
    webster
    Jul 20, 2003
  3. Andrew Thompson
    Replies:
    0
    Views:
    435
    Andrew Thompson
    Aug 5, 2003
  4. Blah Blah
    Replies:
    0
    Views:
    1,457
    Blah Blah
    Aug 13, 2003
  5. Rune Andresen
    Replies:
    2
    Views:
    1,976
    Phil Powell
    Sep 17, 2003
Loading...

Share This Page