注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发JSP → 文章内容

用java实现外部调用exe文件

作者:佚名 来源:不详 发布时间:2007-11-30 0:02:05

  1.0 用java调用windows系统的exe文件,比如notepad,calc之类:
public class Demo{
public static void main(String args[]){
Runtime rn=Runtime.getRuntime();
Process p=null;

try{
p=rn.exec(notepad);
}catch(Exception e){
System.out.println("Error exec notepad");
}
}
}
2.0调用其他的可执行文件,例如:自己制作的exe,或是下载安装的软件
public class Demo{
public static void main(String args[]){
Runtime rn=Runtime.getRuntime();
Process p=null;

try{
p=rn.exec(""D:/AnyQ/AnyQ.exe"");
}catch(Exception e){
System.out.println("Error exec AnyQ");
}
}
}


  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved