Applet help

G

greyham

I've developed a number of applets before but now new ones don't seem
to work. I've got a simple example...

import java.applet.*;
import java.awt.*;
public class testing extends Applet {
public void paint(Graphics g) {
int i=0;
g.drawRect(50,50,60,60);
}//paint
}//class

It compiles fine and I have a html page (testing.html) that reads...

<html>
<body>
<applet code="testing.class" WIDTH="200" HEIGHT="200"</applet>
</body>
</html>

When I view the page in IE, I get a grey rectangle and the error at the
bottom says it can't find testing.class. I keep both in the same
directory too. When I run >appletviewer -debug testing.html, I get:

Initializing jdb ...
run sun.applet.Main testing.html
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.ThrowableVM Started:
The application exited

And that's it. Any thoughts? Thanks
 
L

Last Timer

You may have to use sun's HtmlConverter and enclose the applet class in
<object > </object> tags.
 
G

greyham

Thanks for the error, you're right. So it now works with appletviewer
and I see the rectangle and have time to close it, but I still get the
'uncaught' lines running the debugger. IE also doesn't find the class
file too...?
 
K

klynn47

I ran appletviewer with the debugger on my machine, and I didn't get an
error. I'm run 1.4.0
 
A

Andrew Thompson

You may have to use sun's HtmlConverter and enclose the applet class in
<object > </object> tags.

Certainly not for the code quoted, which is compatible with even
the MSVM (Java 1.1.4).

HTMLConverter is a rather poor alternative in any case.
<http://www.physci.org/codes/javafaq.jsp#version>

Since the code is 1.1 compatible, it makes sense to
stick with the <applet> element.

If it were 1.2, use the JavaVersionApplet and the <applet> element.

If the code were 1.3+, use WebStart.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top