
public static void main(String args[]) throws IOException {
Runtime rt = Runtime.getRuntime();
String[] commands = {"python",CallAnotherProgram.class.getClassLoader().getResource("script.py").getPath()};
Process proc = rt.exec(commands);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
String s = null;
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
}