Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem with creating an applet

Reply
Thread Tools

Problem with creating an applet

 
 
René Beltman
Guest
Posts: n/a
 
      12-22-2005
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(Unk nown 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(Unk nown 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.


 
Reply With Quote
 
 
 
 
Danno
Guest
Posts: n/a
 
      12-22-2005
Given that you are suicidal, I don't think I want to help you solve it.

 
Reply With Quote
 
 
 
 
Oliver Wong
Guest
Posts: n/a
 
      12-22-2005

"René Beltman" <(E-Mail Removed)> wrote in message
news:dof2b7$alf$(E-Mail Removed)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(Unk nown 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


 
Reply With Quote
 
zero
Guest
Posts: n/a
 
      12-23-2005
"René Beltman" <(E-Mail Removed)> wrote in
news:dof2b7$alf$(E-Mail Removed)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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applet - server communication - edited code on the applet side - problem! Rune Andresen Java 2 09-17-2003 06:26 PM
Cool Applet Cool Applet http://24.60.235.213/Grid/ Alisher Fatykhov Java 1 08-06-2003 04:32 AM
Re: newbie: Join JApplet & Applet in one applet Andrew Thompson Java 0 08-05-2003 01:41 PM
Re: play wave files using java.applet.Applet webster Java 0 07-20-2003 01:51 PM
applet vs. canvas in applet Rob Love Java 1 07-07-2003 10:07 PM



Advertisments