java中如何调用系统的计算器程序?

qiuzhi621 2012-05-24 12:36:35
java中如何调用系统的计算器程序
...全文
730 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wang7535067 2012-05-25
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]

Java code
class Calc{
public static void main(String[] args) throws Exception{
Runtime.getRuntime().exec("cmd /c start C:\\WINDOWS\\system32\\calc.exe");
}
}
[/Quote]
正解
WayneXuan 2012-05-25
  • 打赏
  • 举报
回复
class Calc{   
public static void main(String[] args) throws Exception{
Runtime.getRuntime().exec("cmd /c start C:\\WINDOWS\\system32\\calc.exe");
}
}
qiuzhi621 2012-05-25
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 的回复:]
就是 路径不好取
[/Quote]
你知道怎么获取吗?求指教
mengyalizuopeng 2012-05-24
  • 打赏
  • 举报
回复
就是 路径不好取
qfc_thinking 2012-05-24
  • 打赏
  • 举报
回复
Runtime.getRuntime().exec(String arg)
参数是url
superhill 2012-05-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

public class CalculatorCaller{
public static void main(String[] args) throws Exception{
String path="系统计算器的路径";
Runtime ru……
[/Quote]

不好意思,上面+f不知道怎么写错了,应该是+path
superhill 2012-05-24
  • 打赏
  • 举报
回复
public class CalculatorCaller{
public static void main(String[] args) throws Exception{
String path="系统计算器的路径";
Runtime runTime = Runtime.getRuntime();
runTime.exec("cmd /c start " + f);
}
}

我用的Windows 7,计算器的路径在C:/WINDOWS/system32/cal.exe

试试看行不

62,636

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧