How to Execute a Python File With Arguments in Java

I tried this one. This script runs a python file with the argument in Java. It also logs about which line, your program is executing.

Hope this Helps.

    import java.io.BufferedReader;    import java.io.IOException;    import java.io.InputStreamReader;    import java.io.Reader;    public class Test {      public static void main(String... args) throws IOException {        ProcessBuilder pb =                new ProcessBuilder("python","samples/test/table_cv.py","1.pdf");        pb.redirectErrorStream(true);        Process proc = pb.start();        Reader reader = new InputStreamReader(proc.getInputStream());        BufferedReader bf = new BufferedReader(reader);        String s;        while ((s = bf.readLine()) != null) {            System.out.println(s);        }    }  }