Bug: -main function corrupts applet

22 views
Skip to first unread message

Andreas Wenger

unread,
Oct 16, 2009, 7:47:16 AM10/16/09
to Clojure
When writing an applet with Clojure I discovered the following bug:

Whenever a class with a -main function is loaded (e.g. by :use), the
applet is broken (Java 6 with new plugin technology):

java.lang.NullPointerException
at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel
(Plugin2Manager.java:2996)
at sun.plugin2.applet.Plugin2Manager.createApplet
(Plugin2Manager.java:2947)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run
(Plugin2Manager.java:1397)
at java.lang.Thread.run(Thread.java:619)

You can very easily reproduce the problem with the following
experiment I prepared:

http://www.xenoage.com/extern/bugreports/clojure-main-problem.zip

First, look at the .clj files. There are three identical (minimal)
applets. Each uses another (minimal) file: One uses a class with a -
main method, one uses a class with no main method and the third one
uses a renamed main method.
Now, compile the files by calling the build.sh script. When finished,
open the HTML files in the browser. You will see that the two applets
without -main functions work, but the applet with the -main function
fails.

I guess, this is a bug in Clojure?

Andreas Wenger

unread,
Oct 18, 2009, 5:47:51 AM10/18/09
to Clojure
*push*
Can please anybody verify this bug? Should take only 3 minutes or so.

Rich Hickey

unread,
Oct 18, 2009, 10:26:20 AM10/18/09
to Clojure


On Oct 18, 5:47 am, Andreas Wenger <andi.xeno...@googlemail.com>
wrote:
> *push*
> Can please anybody verify this bug? Should take only 3 minutes or so.

A NullPointerException in
sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel isn't enough to
go on. This could be anyone's bug, just because you can change
something in your Clojure code to trigger it doesn't mean the problem
is on the Clojure side.

Does one need main functions in applets?

I found this via googling:

http://www.java-forums.org/java-applets/19544-nullpointerexception-findappletjdklevel-unknown-source.html

Rich
Reply all
Reply to author
Forward
0 new messages