This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Exported variables are null when required from applet, but ok otherwise


On 05/01/2010 09:57 PM, alex mitchell wrote:
That would be great, thanks!

It seems to me that when modules are required from an applet, the module
body is not evaluated. Variables and procedures are declared but variables
aren't initialized, and any code in the module body isn't executed. I tried
adding (module-static 'init-run)
at the top of the imported module as I
figured this would force the module body to be run, but this caused the
following error when running in appletviewer:

$ appletviewer applettest.html
called init.
called start.
java.lang.IllegalAccessError
     at test.<clinit>(test.scm)
     at applettest.start(applettest.scm:6)
     at sun.applet.AppletPanel.run(AppletPanel.java:464)
     at java.lang.Thread.run(Thread.java:637)
$

This fails because when you compile applettest.scm it recompiles test.scm (even if you compile test.scm first and applettest.scm in a second compilation command) - which causes it to extend Applet.

A workaround is to change applettest.scm to require the class rather
than the source file:

(require test)

instead of:

(require "test.scm")

There seems to be a couple of different issues here, which I'll
continue looking at, but hopefully this work-around is OK for you.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]