Embedding in JPython
Steffen Ries
steffen.ries at sympatico.ca
Wed Aug 2 07:51:06 EDT 2000
"Magnus Lie Hetland" <mlh at idi.ntnu.no> writes:
> Steffen Ries <steffen.ries at sympatico.ca> wrote in message
> news:m3d7jtjhty.fsf at gondolin.beleriand...
> > Hi,
> >
> > just a simple question:
> >
> > I'm trying to embed a script into a Java application.
> [...]
> >
> > Is there a way to call a python function directly?
> >
> > For now I have implemented:
> > interp.set("java_obj", javaObj);
> > interp.exec("foo(java_obj)");
> > which looks rather in-elegant.
>
> Well - this is what is done in the documentation...
ok, so I didn't miss an alternative... :-)
> But can't you wrap in a java-method foo(Object)? That way you can
> at least encapsulate your in-elegance ;) And you won't have to
> write the above more than once...
you mean like
public void foo(Object) {
interp.set("jo", Object);
interp.exec("foo(jo)");
}
?
sure, that's what I'm doing.
thanks,
/steffen
--
steffen.ries at sympatico.ca <> Gravity is a myth -- the Earth sucks!
More information about the Python-list
mailing list