调用方法: import java.io.BufferedReader; import java.io.InputStreamReader; public class PythonInvoke { public static void invokePy(String[] args) { try { Process process = Runtime.getRuntime().exec(args); //防止Python输出中文时乱码 BufferedReader in = new Buffere…
当Java需要调用windows系统进行交互时,可以使用Runtime进行操作. 例子: 1.调用window中获取关于java相关的进行信息 Runtime rt = Runtime.getRuntime(); Process p = rt.exec("wmic process where caption=\"javaw.exe\" get caption,commandline /value"); BufferedReader br = new Buffered…