From: Gustav B. <Gus...@eo...> - 2002-02-28 10:52:06
|
Hi! I'm still not getting this to work. Now I get another error-message: Traceback (innermost last): File "<console>", line 1, in ? File = "v:\eonworx_testbed\gubos\src\python\python-geAamB", line 14, in = runHello java.lang.IllegalAccessException at java.lang.reflect.Constructor.newInstance(Native Method) at = org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.ja= va) at org.python.core.PyJavaInstance.__init__(PyJavaInstance.java) at org.python.core.PyJavaClass.__call__(PyJavaClass.java) at org.python.core.PyObject.__call__(PyObject.java) at = org.python.pycode._pyx2.runHello$2(v:\eonworx_testbed\gubos\src\python\py= thon-geAamB:14) at = org.python.pycode._pyx2.call_function(v:\eonworx_testbed\gubos\src\python= \python-geAamB) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyFunction.__call__(PyFunction.java) at org.python.pycode._pyx3.f$0(<console>:1) at org.python.pycode._pyx3.call_function(<console>) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyCode.call(PyCode.java) at org.python.core.Py.runCode(Py.java) at org.python.core.Py.exec(Py.java) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java) at = org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.jav= a) at = org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.j= ava) at = org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.j= ava) at org.python.util.InteractiveConsole.push(InteractiveConsole.java) at = org.python.util.InteractiveConsole.interact(InteractiveConsole.java) at org.python.util.jython.main(jython.java) java.lang.IllegalAccessException: java.lang.IllegalAccessException What could be causing this? My classpath does not contain the Hello class (I checked with : >>> for path in System.getProperty("java.class.path").split(";"): ... print path) I've been getting this error when I try to use sys.add_extdir too. I = never seem to get this dynamic loading of Java-classes to work. I must = be doing something very wrong. /Gustav -----Original Message----- From: Samuele Pedroni [mailto:pe...@in...] Sent: Wednesday, February 27, 2002 6:15 PM To: Gustav Bostrom; Jython (E-mail) Subject: Re: [Jython-users] Example of Java class reloading Example of Java class reloadingHi From: Gustav Bostrom >Hi! >I'm struggling to get the Java-class reloading to work. >I'm not very succesful. >Does anyone have a good example to share? >I tried this, but it didn't work: >import jreload >classpath=3D["V:\\eonworx\\output\\contrib\\studio\\classes"] >classesLoadSet=3Djreload.makeLoadSet("classes",classpath) >print classesLoadSet >from classes import Hello >jreload.reload(classesLoadSet) you don't need this jreload.reload call >def rl(): > jreload.reload(classesLoadSet) >def runHello(): > Hello().sayHello() > > When I run rl() the Hello-class is still not reloaded and runHello() = still produces the old result. Assuming that you have changed the class before calling rl() <wink>, the = code seems correct. The Jython Demo/jreload directory contains the artifacts to run the = interactive session example in Doc/jreload.html documentation. Up to bugs, the only important thing to remember is that the LoadSet = path should be disjunct from classpath and sys.path otherwise reloading will not = work (Java limitation). regards, Samuele Pedroni. |