Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

Differences between Appletviewer and Browser plugin

Thread view: 
Daniel Kraft - 15 Jul 2007 10:23 GMT
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

Signature

Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!

Roedy Green - 15 Jul 2007 11:58 GMT
>The applet is this one:
>http://domob.do.funpic.de/klammgolf/turnier.php?id=1

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.

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Daniel Kraft - 15 Jul 2007 12:33 GMT
>> The applet is this one:
>> http://domob.do.funpic.de/klammgolf/turnier.php?id=1
[quoted text clipped - 28 lines]
> 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

Signature

Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!

Thomas Fritsch - 15 Jul 2007 18:25 GMT
Daniel Kraft schrieb:

> I changed my code according to your suggestions but I still get this
> error from within the browser:
[quoted text clipped - 3 lines]
> 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.

Signature

Thomas

Roedy Green - 15 Jul 2007 20:26 GMT
>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?
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrew Thompson - 15 Jul 2007 13:44 GMT
...
>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>

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.