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;    import;    import;    import;    public class Test {      public static void main(String... args) throws IOException {        ProcessBuilder pb =                new ProcessBuilder("python","samples/test/","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);        }    }  }