From: Thomas H. <tho...@io...> - 2001-01-12 12:17:31
|
I wrote: > >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? > and Finn replied: > 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. > """ > My problem is solved with the help of Jeff Emanuel who sent me the right answer: My class containing the native method(s) was not declared public. It works fine now. Thanks, Thomas |