Differences between Appletviewer and Browser plugin

R

Roedy Green


your invoking code looks like this

<applet code="eu.domob.klammgolf.player.PlayApplet"
width="750" height="550"
archive="java/klammgolf.jar, java/minigolf.jar, java/Piccolo.jar , ,
, , ">
<param name="numCourses" value="4" />
<param name="course0"
value="bahnen/bahn_1182668925894638649.jar" />
<param name="course1"
value="bahnen/bahn_1182668933804355172.jar" />
<param name="course2"
value="bahnen/bahn_11826689382141266564.jar" />
<param name="course3"
value="bahnen/bahn_1182668944163310470.jar" />
Du ben&ouml;tigst eine <a href="http://java.sun.com/">Java-VM</a>, um
Klammgolf
spielen zu k&ouml;nnen.
</applet>

My typical invoking code looks like this:
<applet class="cmp" code="com.mindprod.wassup.Wassup.class"
archive="wassup.jar" width="540" height="310" alt="Sorry, you need
Java to run this Applet">
</applet>

Note the .class on the code param. Also there should be no embedded
spaces in your archive param, just commas. I would get rid of the
trailing commas.
 
D

Daniel Kraft

Hi all,

first of all, I'm not completely sure whether this is really a good
group for Java Applet questions -- if not, please point me to another one.

I've written a Java Applet; my problem is that the very same applet runs
fine under Sun's appletviewer, but the Browser plugin (Mozilla) of the
same JDK (1.5.0_06, GNU/Linux) complains that it does not find my Applet
class.

What are the differences between appletviewer and the Browser with plug
in that could make such a thing happen? I'm currently a bit confused by
this problem...

The applet is this one:
http://domob.do.funpic.de/klammgolf/turnier.php?id=1

# appletviewer http://domob.do.funpic.de/klammgolf/turnier.php?id=1
works fine, opening this URI in my browser gives me a "broken applet"
symbol!

Could this be a problem with caches or something similar?

Many thanks,
Daniel
 
A

Andrew Thompson

Daniel Kraft wrote:
...
I've written a Java Applet; my problem is that the very same applet runs
fine under Sun's appletviewer, but the Browser plugin (Mozilla) of the
same JDK (1.5.0_06, GNU/Linux) complains that it does not find my Applet
class.

FF on Win. running Java 1.6 reports..
...
basic: Exception: java.lang.ClassFormatError: Incompatible
magic value 1008813135 in class file eu/domob/klammgolf/player/PlayApplet
What are the differences between appletviewer and the Browser with plug
in that could make such a thing happen?

The differences between how applets behave in most
browsers, running most Java versions, with any variety
of plug-ins installed or security enabled, is slightly
different in most combinations.

If one combination (of browser make and version,
combined with Java version, plug-ins/security) actually
matched the behaviour of AppletViewer in every way,
it would be almost purely by accident.
...I'm currently a bit confused by
this problem...

Yes - applets can be that way - epsecially with every
browser reporting the problem in slightly different ways.
An earlier test with IE showed an odd applet loaded
(odd in the sense that nothing seemed to be in the
center of the GUI, just a title bar and a bar on the lower
right), but when I clicked something that attempted to
reload the page, IE 'froze and crashed'.
Could this be a problem with caches or something similar?

Why not launch that applet using web start?*
It uses applet viewer, and removes a lot of the
browser based variables. At least the error
messages, if any, should be consistent!

* e.g. <http://www.physci.org/jws/#jtest>

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1
 
D

Daniel Kraft

The applet is this one:
your invoking code looks like this

<applet code="eu.domob.klammgolf.player.PlayApplet"
width="750" height="550"
archive="java/klammgolf.jar, java/minigolf.jar, java/Piccolo.jar , ,
, , ">
<param name="numCourses" value="4" />
<param name="course0"
value="bahnen/bahn_1182668925894638649.jar" />
<param name="course1"
value="bahnen/bahn_1182668933804355172.jar" />
<param name="course2"
value="bahnen/bahn_11826689382141266564.jar" />
<param name="course3"
value="bahnen/bahn_1182668944163310470.jar" />
Du ben&ouml;tigst eine <a href="http://java.sun.com/">Java-VM</a>, um
Klammgolf
spielen zu k&ouml;nnen.
</applet>

My typical invoking code looks like this:
<applet class="cmp" code="com.mindprod.wassup.Wassup.class"
archive="wassup.jar" width="540" height="310" alt="Sorry, you need
Java to run this Applet">
</applet>

Note the .class on the code param. Also there should be no embedded
spaces in your archive param, just commas. I would get rid of the
trailing commas.

Thanks for your reply, however, the very same invocation code used to
work with a previous version of my Java code (unfortunatelly I can't
trace down which change made it break), the main difference between
these versions is that I added a Frame which displays what prior was the
Applet's content and another Applet into the same Jar which is not
referenced from this file.

I changed my code according to your suggestions but I still get this
error from within the browser:

load: class eu.domob.klammgolf.player.PlayApplet.class not found.
java.lang.ClassNotFoundException: eu.domob.klammgolf.player.PlayApplet.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:168)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:599)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:721)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1757)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:650)
at sun.applet.AppletPanel.run(AppletPanel.java:324)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:271)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:44)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:158)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:155)
... 9 more
Exception in thread "Thread-5" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(GrayBoxPainter.java:153)
at sun.plugin.AppletViewer.showAppletException(AppletViewer.java:1928)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:655)
at sun.applet.AppletPanel.run(AppletPanel.java:324)
at java.lang.Thread.run(Thread.java:595)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(GrayBoxPainter.java:153)
at sun.plugin.AppletViewer.showAppletStatus(AppletViewer.java:1861)
at sun.applet.AppletPanel.run(AppletPanel.java:369)
at java.lang.Thread.run(Thread.java:595)
Exception in thread "thread
applet-eu.domob.klammgolf.player.PlayApplet.class"
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(GrayBoxPainter.java:153)
at sun.plugin.AppletViewer.showAppletException(AppletViewer.java:1928)
at sun.applet.AppletPanel.run(AppletPanel.java:533)
at java.lang.Thread.run(Thread.java:595)

I've really no clue at all why something would work inside appletviewer
and not the browser. But the problem must be some difference in how
they resolve or download classes, must it not?

Cheers,
Daniel
 
T

Thomas Fritsch

Daniel said:
I changed my code according to your suggestions but I still get this
error from within the browser:

load: class eu.domob.klammgolf.player.PlayApplet.class not found.
java.lang.ClassNotFoundException:
eu.domob.klammgolf.player.PlayApplet.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:168) [...]

I've really no clue at all why something would work inside appletviewer
and not the browser. But the problem must be some difference in how
they resolve or download classes, must it not?

I visited your page
<http://domob.do.funpic.de/klammgolf/turnier.php?id=1> with my browser
(Mozilla/4.0 (Windows XP 5.1) with Java Plug-in 1.6.0_01) and also got
the "applet broken" icon. But in my Java console I have the output:

java.lang.ClassFormatError: Incompatible magic value 1008813135 in class
file eu/domob/klammgolf/player/PlayApplet
at java.lang.ClassLoader.defineClass1(Native Method)
...

Note that this exception is about the PlayApplet class being
*corrupted*, not about PlayApplet class being *not found*.

When looking into your jar file
<http://domob.do.funpic.de/klammgolf/java/klammgolf.jar> with WinZip,
I see that it contains all class files (including PlayApplet.class)
*two* times. You should fix this first.
 
R

Roedy Green

Caused by: java.io.IOException: open HTTP connection failed.

Sounds like it might be having trouble reading the jars. Are they in
the same directory as the *.html file that invoked them?

Is your firewall blocking *.jar file downloads?
 

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,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top