您的位置:首页 > 编程语言 > Java开发

java中调用外部exe文件

2015-09-14 23:55 405 查看
  Runtime   runtime   =   new   Runtime();  
  String   fileName   =   "c:\\test.txt";  
  String   commandStr   =   "rundll32   url.dll,FileProtocolHandler   "+fileName;  
  runtime.exe(commandStr   );  
  或者  
  Runtime   runtime   =   new   Runtime();  
  String   fileName   =   "c:\\test.txt";  
  String   commandStr   =   "notePad   "+fileName;  
  runtime.exe(commandStr   );  

  或者

  Runtime   rt=Runtime.getRuntimee();  
  rt.exec("C:\\Program   Files\\Accessories\\Wordpad   D:\\xxxx.txt");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: