【发布时间】:2020-02-17 22:54:40
【问题描述】:
我想用 Jython 打开一个特定的浏览器。
我相信这是how it is done with Java:
Runtime rt = Runtime.getRuntime();
rt.exec(new String[]{"cmd", "/c","start chrome http://www.stackoverflow.com"});
我尝试将 Java 转换为 Jython:
from java.lang import Runtime
Runtime = Runtime.getRuntime()
Runtime.exec("start chrome http://www.stackoverflow.com");
但是,它失败了:
java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2,
The system cannot find the file specified in <script> at line number 3
BMXAA7837E - An error occured that prevented the TESTURL script for the LP23 launch point from running.
java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2, The system
cannot find the file specified in <script> at line number 3
是否可以使用 Jython 打开特定的浏览器?
【问题讨论】:
-
注意:在我的 Jython (Maximo 7.6.1.1) 实现中,无法导入 Python 库。
-
Runtime.exec("cmd /c start chrome http://www.stackoverflow.com")为我工作(但我没有使用 Maximo)。
标签: java browser jython runtime.exec jython-2.7