From: Oti <oh...@ya...> - 2002-02-26 13:01:05
|
--- ni...@bi... wrote: > Hi, I want to use jython to make some calculations in my java program > and return a result to my jython program. I am creating an instance > of jython interpreter in my java program and calling the > interpreter's exec method. It do some computatios and create a set of > objects. I have to use this set of objects in my java program. I mean > jython interpreter MUST return a set to my java program. However, the > exec method returns void value. How can I use jython in my java > program so that I can use the values that were calculated in jython > directly in my java code ? Thx, a lot. If you use the eval() method of the interpreter, you get the result back as a PyObject. You can then turn this into a Java Object using the static method Py.tojava(), or the __tojava__() method on PyObject itself. HTH, Oti. __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com |