Jython in a signed applet

Ike rxv at hotmail.com
Sat Jun 5 22:30:56 EDT 2004


I have a signed JApplet which has a JTextArea wherein one can put Jython
Script. Upon clicking a JButton, the script is executed. The script which
executes to code is listed below.

If I run the Applet in an AppletViewer, it runs fine. However, when run in a
web browser, I am getting NullPointerException's (I copy-pasted from the
Java Console these Exceptions). Please Note, I AM including jython.jar in
the ARCHIVE parameter of the HTML containing the JApplet.

Anyone have any idea why I cannot get this to run in a signed applet? Does
anyone execute script in a signed applet - would you be willing to show me
how to call this from Java, and what the Applet tag looks like that works
for you? Thanks, Ike

                PythonInterpreter inter_py; //class-scope variable

                //the following occurs in the ActionListnener when the
JButton is clicked

                    if(inter_py==null){
                        try{

PythonInterpreter.initialize(System.getProperties(), System.getProperties(),
new String[] {""});
                            inter_py = new PythonInterpreter();
                        }catch(PyException pyex){
                            pyex.printStackTrace();
                        }catch(Exception exc){
                            exc.printStackTrace();
                        }
                    }
                    try{
                        inter_py.exec(bsTextArea.getText());
                    }catch(PyException pyex){
                        pyex.printStackTrace();
                    }catch(Exception exc){
                        exc.printStackTrace();
                    }


java.lang.NullPointerException
     at org.python.core.PyJavaClass.lookup()
     at org.python.core.PyObject.<init>()
     at org.python.core.PySingleton.<init>()
     at org.python.core.PyNone.<init>()
     at org.python.core.PySystemState.initStaticFields()
     at org.python.core.PySystemState.initialize()
     at org.python.core.PySystemState.initialize()
     at org.python.util.PythonInterpreter.initialize()
     at GG.GGUser$10.run()
     at java.awt.event.InvocationEvent.dispatch(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
     at GG.GGUser$10.run()
     at java.awt.event.InvocationEvent.dispatch(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)






More information about the Python-list mailing list