|
From: Robert W. <wi...@gm...> - 2006-08-08 10:29:58
|
> The first issue I see with the Jython code is that you do not subclass > a Java class. If you are not using anything which requires > subclassing, just subclass java.lang.Object as such: > > from java.lang import Object > class PyClass(Object): > ... Ok. Now I can compile my java class (the compiler finds the class and the method). That makes a lot of sense; everything in Java must subclass java.lang.Object. Someone should write a script to at Object as superclass for all classes so we don't need to subclass explicitly, like it is in Java. > As far as the error goes, I haven't ever seen any issues using 1.5 in > my own environment. I can bet you that the assertion error has > something to do with the subclassing...but don't quote me on that. Very curious! I still need the "source 1.3" Option and i still get warnings with this option. I tried jython_2.2a (the readme.txt says "support for running on jdk1.5") and it compiles without "source"-option and without any warning!? So jython 2.1 is just not compatible with jdk1.5, because it generates method with names that are keyword (assert, enum) in newer java version. But why doesn't anybody but me have problems with this ??? Unfortunately it still doesn't work! :( > There are several good articles on this topic. Check this one out > which I wrote last month: > http://wiki.python.org/jython/JythonMonthly/Articles/July2006/1 , it > may help you out. I tried the first example in this article (Foo and FooTest) and I have the same problem as with my own example, I'm getting a NullPointerException from the constructor of the jython class: Exception in thread "main" java.lang.NullPointerException at org.python.core.PyJavaClass.lookup(PyJavaClass.java:43) at org.python.core.PyObject.<init>(PyObject.java:46) at org.python.core.PySingleton.<init>(PySingleton.java:8) at org.python.core.PyNone.<init>(PyNone.java:10) at org.python.core.PySystemState.initStaticFields(PySystemState.java:396) at org.python.core.PySystemState.initialize(PySystemState.java:375) at org.python.core.Py.initProperties(Py.java:696) at org.python.core.Py.initProxy(Py.java:738) at Foo.__initProxy__(Foo.java:186) at Foo.<init>(Foo.java:164) at FooTest.main(FooTest.java:3) so what's wrong now??? thanks for your help robert |