Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Jython/Python and the fly likes Executing Jython script from java and accessing resulting object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Executing Jython script from java and accessing resulting object" Watch "Executing Jython script from java and accessing resulting object" New topic
Author

Executing Jython script from java and accessing resulting object

Kunal Sathe
Ranch Hand

Joined: Apr 08, 2005
Posts: 49
Hello All,

I am running a jython script from my java program and I would like to access the resulting value/object. The script returns a boolean value true/false, and I want to access the value as a java.lang.Class.Boolean object. Can someone guide me in the right direction?

Thanks in advance.

Kunal

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

You might try:

As long as value is in the correct scope (not sure if it is).

Another thing to try would be to make the checkLastName() method return the true/false, then use interpreter.eval() to call the method and get the results. Something like this:



Note that I have no experience with Jython, but am just starting Python. So I could be way off...


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing Jython script from java and accessing resulting object
 
Similar Threads
Jython?
Help - How to I tell java where my jython.py script is located in the Directory
Embedding Jython in JAVA Application
file not found when calling execfile function
PythonInterpreter.initialize