Sto usando Jython all'interno di un progetto Java.Come chiamare un metodo python da una classe java?
Ho una classe Java: myJavaClass.java
e uno Python classe: myPythonClass.py
public class myJavaClass{
public String myMethod() {
PythonInterpreter interpreter = new PythonInterpreter();
//Code to write
}
}
Il file di Python è la seguente:
class myPythonClass:
def abc(self):
print "calling abc"
tmpb = {}
tmpb = {'status' : 'SUCCESS'}
return tmpb
Ora il problema è che voglio chiamare il metodo di abc()
il mio file Python dal metodo myMethod
del mio file Java e stampare il risultato.
Cos'hai provato? Hai guardato questo: http://www.jython.org/archive/21/docs/embedding.html? – grifaton