Calling Jython code from Java
Derek Thomson
derek at hiredgoons.org
Tue May 18 08:53:52 EDT 2004
Raja wrote:
> I have a java class thats trying to call something in python. This
> works fine when i do a jythonc on the python script.
[snip]
>
> class testconfig(java.lang.Object):
>
> def __init__(self):
> """@sig public testconfig()"""
> self._cfg = configuration.configuration("/sources/jmxproto")
[snip]
> class configuration:
>
> def __init__(self, runtimeDir=None):
> """@sig public configuration(java.lang.String dir)"""
> """ Some code in here """
>
> When i call testconfig.py, i get the error mentioned above. Any clues?
In Python, you just use the class name to create instances.
So I think that perhaps:
self._cfg = configuration.configuration("/sources/jmxproto")
Should be:
self._cfg = configuration("/sources/jmxproto")
IIRC the "@sig" declaration only comes into play when attempting to use
the class from *Java* code. That's why there is no "configuration"
attribute.
Regards,
Derek.
More information about the Python-list
mailing list