From: <bc...@wo...> - 2001-01-12 09:25:11
|
[Thomas Heller] >I'm just trying to get up to speed with Jython: Very impressive! > >One problem though: > >I have a java JNI component which allows to set the color >of the Console (I'm using win2000 here). >This works fine from any java console program, >but from jython (or even from the program compiled with >jythonc) I get a traceback: > >C:\work\chip\debugger>jython >Jython 2.0beta1 on java1.3.0 (JIT: null) >Type "copyright", "credits" or "license" for more information. >>>> from ColoredConsole import setColor >>>> setColor(10) >Traceback (innermost last): > File "<console>", line 1, in ? >java.lang.IllegalAccessException >... > >Is it possible to use native methods together with jython? Generally yes. I have done so extensively in my JNI based "os" module implementation. One advice which I remember, is to put your java class into a package. [Quoting JimH from 25 Nov 1998:] """ > Does JNI work with jpython? I've been fiddling with it but haven't > gotten it to work. I'm guessing that the entire problem here is related to using the top-level unnamed package. I've gone into some of the issues with this before, so I won't reiterate them here. The summary is that whenever anything goes wrong with a top-level package, my first suggestion is to move it into a real named package. """ Unfortunately I can't find the post where Jim goes over the issues. regards, finn |