I have created an PythonInterpreter object, and want to call a java function but keep getting the error:
Exception in thread "main" Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'jytest2' is not defined
Java Result: 1
How do you call a java function from a live running system?
public static void main(String args[])
{
ModRet modRet = new ModRet();
jytest();
}
public void jytest()
{
PythonInterpreter interp = new PythonInterpreter();
interp.exec("print \'Hello; jython has successfully been embedded!\'");
interp.exec("print " + FPS);
interp.exec("jytest2()");
}
public void jytest2()
{
System.out.println("HIHIHI");
}
interp.exec(String)will only interpret in Python/Jython language; did you have the Python functionjytest2()created for interpretation? That is what I can understand from the error message as it could not find the function...You may need to import from a library that has the function first before you can use it.