问题描述
- java调用python时报错。
-
我在用java调用一个main.py文件时报错,但是在同样的路劲下调用搜狗的.exe文件能运行public static void main(String[] args) { Runtime rn = Runtime.getRuntime(); Process p = null; try { // PythonInterpreter interpreter = new PythonInterpreter(); // InputStream filepy = new FileInputStream("D:demo.py"); // interpreter.execfile(filepy); ///执行python py文件 // filepy.close(); p = rn.exec("e:/python/main.py"); InputStreamReader isr=new InputStreamReader(p.getInputStream(),"gbk"); BufferedReader br=new BufferedReader(isr); String res; while((res = br.readLine())!= null){ System.out.println(res); } } catch (IOException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } Cannot run program "e:/python/main.py": CreateProcess error=5, ???·? at java.lang.ProcessBuilder.start(ProcessBuilder.java:470) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:431) at java.lang.Runtime.exec(Runtime.java:328) at com.desktop.ipnet.B.main(B.java:21)
解决方案
ListView在removeFooterView时报java.lang.ClassCastException错问题
时间: 2024-12-21 04:59:12