linux Runtime
来源:互联网 发布:js 隐藏鼠标 编辑:程序博客网 时间:2024/05/22 11:50
Runtime.getRuntime().exec("main.exe "你的字符"")
------------------------------------------------------------------------
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.getRuntime().exec("test.exe "+param1+" "+param2+" "+param3);
Runtime.getRuntime().exec("c:\\windows\\system32\\cmd echo abc");
public class transferExe {
/**
* @param args
*/
public static void main(String[] args) {
openWinExe();
openMyExe();
}
// 用Java调用windows系统的exe文件,比如notepad,calc之类
public static void openWinExe() {
Runtime rn = Runtime.getRuntime();
Process p = null;
try {
String command = "notepad";
p = rn.exec(command);
} catch (Exception e) {
System.out.println("Error win exec ");
}
}
// 2.0调用其他的可执行文件,例如:自己制作的exe,或是下载安装的软件
public static void openMyExe() {
Runtime rn = Runtime.getRuntime();
Process p = null;
try {
p = rn.exec("\"E:/QQ2008Spring.exe\"");
} catch (Exception e) {
System.out.println("Error my exec ");
}
}
}
在Java程序中获取当前运行程序的路径
import java.io.*;
public class Test {
public static void main(String[] args) {
File directory = new File(".");
try {
File newPath = new File(directory.getCanonicalPath()+"NewFolder");
newPath.mkdir();
}catch(Exception exp)
{
exp.printStackTrace();
}
}
}
//File directory = new File(".");
//directory.getCanonicalPath();取得当前路径
String[] open={"NotePad.exe","C:\\1.txt"};
Runtime.getRuntime().exec(open);
Runtime rt=Runtime.getRuntimee();
rt.exec("C:\\Program Files\\Accessories\\Wordpad D:\\xxxx.txt");
Top
- linux Runtime
- linux pm runtime
- linux pm runtime
- linux pm runtime
- Linux Runtime PM介绍
- Linux Runtime Memory Measurement
- linux runtime framwork
- Linux Runtime PM介绍
- Linux Runtime PM介绍
- Runtime.exec()执行linux shell
- Linux --Install Sun Java Runtime
- Runtime.exec()执行linux shell
- Runtime.exec()执行linux shell
- Linux电源管理-Runtime PM
- Linux电源管理-Runtime PM
- linux 定期清理runtime缓存
- Android Runtime运行linux命令
- runtime
- 常用-打印-刷新--WebBrowser OBJECT
- Linux上杀死eclipse进程
- 为什么说ucos ii是可剥夺的内核。
- C++学习-集成开发环境CodeBlocks(1)
- BOSH vs WebSockets:
- linux Runtime
- malloc、calloc 、new 的区别
- jQuery使用技巧
- 润乾报表实现日历功能
- SSD固态硬盘开启云存储的新时代——SSD资料整理
- Ubuntu配置php上传文件限制
- Android Chronometer控件开发
- 我的第一篇博文 记录HTML5的学习(前言)
- C++学习-类和对象(2)