黑马程序员技术交流社区

标题: Runtiem 小问题 [打印本页]

作者: 唐志海    时间: 2014-1-11 18:22
标题: Runtiem 小问题
  1. public class RuntimeDemo
  2. {
  3.         public static void main(String[] args)throws Exception
  4.         {
  5.                 Runtime r=Runtime.getRuntime() ;
  6.                 r.exec("iexplore.exe");
  7.                
  8.         }
  9. }
复制代码
为什么我打不开IE的程序呢?(Cannot run program "iexplore.exe": CreateProcess error=2, ?????????)
作者: yaohsieh    时间: 2014-1-11 18:38
  1. public class RuntimeDemo {
  2.         public static void main(String[] args) throws Exception {
  3.                 Runtime r = Runtime.getRuntime();
  4.                 r.exec("C:\\Program Files\\Internet Explorer\\iexplore.exe");
  5.         }
  6. }
复制代码

iexplore.exe不是system32下面的,修改为全路径就好了
作者: 淡夜清风    时间: 2014-1-11 18:45
路径问题,改为r.exec("C:\\Program Files\\Internet Explorer\\iexplore.exe");
作者: 唐志海    时间: 2014-1-11 18:57
yaohsieh 发表于 2014-1-11 18:38
iexplore.exe不是system32下面的,修改为全路径就好了

可是不是默认路径要是没找到的话查找其他路径啊




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2