Message253
In my app I don't use CLASSPATH much 'cause it gonna be somewhat big (about 50 jars)
Instead of this I use wildcard as argument to my app-launcher, which parses wildcard and finds every jar i need (builds net of ClassLoaders etc.) and Class.forName("anyClass"); works just fine in any piece of app.
Jython package manager(SysPackageManager.java) uses "java.class.path" property alot when huntin' for jars.
In my app-launcher expand-java.class.path code was added
someth' like that
String currPath = System.getProperty("java.class.path");
String separator = ";";
currPath += separator + "myPackage.jar";
System.setProperty("java.class.path", currPath);
After that modification alot of
*sys-package-mgr*: processing new(modified) jar, 'X:\a\b\c.jar'
was shown at the Jython initialization /Py.initPython();/ assuming everithing Ok.
BUT!
"from a.b.c.d import myClass" - ImportError: cannot import name myClass
"from a.b.c.d import *" - Ok
"dir()" - names of classes with myClass among... Hm?????
"d = new myClass()" -
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.python.core.PyJavaClass.init__class__(PyJavaClass.java:143)
at org.python.core.PyJavaClass.init(PyJavaClass.java:214)
at org.python.core.PyJavaClass.initLazy(PyJavaClass.java:78)
at org.python.core.PyJavaClass.initialize(PyJavaClass.java:94)
at org.python.core.PyJavaClass.initConstructors(PyJavaClass.java:629)
at org.python.core.PyJavaClass.__call__(PyJavaClass.java:781)
at org.python.core.PyObject.__call__(PyObject.java:260)
at org.python.pycode._pyx4.f$0(<console>)
at org.python.pycode._pyx4.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.Py.runCode(Py.java:1050)
at org.python.core.Py.exec(Py.java:1071)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:124)
When I put jar containing myClass.class in CLASSPATH explicitly - everithing perfect.
Try to put something like
String currPath = System.getProperty("java.class.path");
String separator = ";";
currPath += separator + "myPackage.jar";
System.setProperty("java.class.path", currPath);
at the beginning of org.python.util.jython and don't put myPackage.jar at CLASSPATH and HAVE FUN ;)
andrew@ibis.odessa.ua |
|
Date |
User |
Action |
Args |
2008-02-20 17:16:47 | admin | link | issue228540 messages |
2008-02-20 17:16:47 | admin | create | |
|