TODO: Execute Python script
System.out.println ("Start Python");
Parameters to be passed
String a = "AAA", B = "BBB", C = "CCC", D = "ddd";
System.out.println ("start;;;" + a);
Set command line incoming parameter
string[] args = new string[] {"Python", "c:\\users\\desktop\\test1.py", A, B, C, d};
Process PR = runtime.getruntime (). exec (args);
TODO: This method can only pass strings
// Process PR = runtime.getruntime (). EXEC ("Python c:\\users\\desktop\\test1.py c:\\users\ \hpp\\desktop\\test1.mp4 ");
BufferedReader in = new BufferedReader (New InputStreamReader (Pr.getinputstream ()));
String Line;
while (line = In.readline ())!= null) {
//Line = Decodeunicode (line);
System.out.println (line);
In.close ();
Pr.waitfor ();
System.out.println ("End");
test1.py (test whether the parameters can be taken)
Import sys
print sys.argv[0]
print sys.argv[1] print
sys.argv[2] Print
sys.argv[3]
Print SYS.ARGV[4]