日期:2014-05-20  浏览次数:20771 次

JAVA接收python函数返回数据
我用Python程序返回了HTML数据(写在程序里的) 现在想用java把数据捕获到 ,有什么好的方法么?

------解决方案--------------------
用java scripting engine
Java code
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class jythonEx
{
    public static void main (String args[]) throws ScriptException
    {
        ScriptEngineManager mgr = new ScriptEngineManager();
        ScriptEngine pyEngine = mgr.getEngineByName("python");
        try {
            pyEngine.eval("print \"Python - Hello, world!\"");
        } catch (Exception ex) {
            ex.printStackTrace();
        }       
    }
}

------解决方案--------------------
探讨

用java scripting engine
Java code
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class jythonEx
{
public static void main……