You can also send arguments:
variableNamePython = subprocess.Popen(["java", "-jar", "lib/JavaTest.jar", variable1, variable2, variable3], stdout=subprocess.PIPE) JavaVariableReturned = variableNamePython.stdout.read() print "The Variable Returned by Java is: " + JavaVariableReturned
The Java code to get these variables will look like this:
public class JavaTest { public static void main(String[] args) throws Exception { String variable1 = args[0]; String variable2 = args[1]; String variable3 = args[2];
source share