java中可以调用.exe文件么?谢谢 可以了,你查看一下 Process 那个类,有个 exec 方法的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 像下面这样调用:Process child = Runtime.getRuntime().exec(cmd);//调用cmd.exe,也可以是其它可执行文件 import java.lang.*;import java.io.*;public class LoadWinApp{ public static void main(String args[]) throws IOException { Runtime r = Runtime.getRuntime(); Process p = null; String strWinApp = "cmd start"; String strWinFile = "test.xls"; if(args.length > 1) { strWinApp = args[0]; strWinFile = args[1]; } try { //p = r.exec(strWinApp); p = r.exec(strWinApp + " " + strWinFile); } catch(Exception e) { e.printStackTrace(); } }} java线程问题,请高手帮忙 播放幻灯片问题 请教各位大哥一个流的操作问题! 如何用JAVA写一段程序产生一个HTML文件? !!深入探讨JVM:Java线程同步使用的“监视器”和“对象锁”是不是一回事?他们的关系如何? 请教一个简单问题 高分请教:java如何根据字符串中头一个字符来判断字符串的类型? 关于java传引用的一个疑惑,各位大侠请帮个忙! 散分啦!! 菜鳥問題 APPLET运行出错,求助 新手求救,环境配置问题(急!)
Process child = Runtime.getRuntime().exec(cmd);//调用cmd.exe,也可以是其它可执行文件
import java.io.*;public class LoadWinApp
{
public static void main(String args[]) throws IOException
{
Runtime r = Runtime.getRuntime();
Process p = null;
String strWinApp = "cmd start";
String strWinFile = "test.xls"; if(args.length > 1)
{
strWinApp = args[0];
strWinFile = args[1];
}
try
{
//p = r.exec(strWinApp);
p = r.exec(strWinApp + " " + strWinFile);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}