We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › JavaScript JSObject library.
Page Index Toggle Pages: 1
JavaScript JSObject library. (Read 385 times)
JavaScript JSObject library.
Feb 2nd, 2009, 6:23pm
 
Hi, I can't get netscape.javascript.* to work. The Java console says JSException and NullPointerException.

netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(JSObject.java:141)
at fun_project.<init>(fun_project.java:21)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorI
mpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorA
ccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:785)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:2302)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
at sun.applet.AppletPanel.run(AppletPanel.java:368)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at java.applet.Applet.getParameter(Applet.java:174)
at netscape.javascript.JSObject.getWindow(JSObject.java:112)
... 12 more



This is the offending line.
JSObject window = (JSObject) JSObject.getWindow(this);


What am I doing wrong?
Where can I find the reference/guide for this library?

I mostly work with JavaScript and Scheme. Java documentation is driving me insane.. help!


#### EDIT #####
I'm an idiot. I had to put declaration in the top level and assignment inside a function. It works now. Thanks..
Page Index Toggle Pages: 1