java中指定命令,打开指定软件(.exe),与此同时打开指定文件
java中指定命令,打开指定软件(.exe),同时打开指定文件
// 调用其他的可执行文件,例如:自己制作的exe,或是 下载 安装的软件. 并打开指定路径下的文件
public static void openExe(String path) {
final Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec(path);
} catch (final Exception e) {
System.out.println("Error exec!");
}
}
public static void main(String[] args) throws IOException {
String path="E:\\noteapd++\\Notepad++\\notepad++.exe f:\\Sessions.txt";
openExe(path);
}
// 调用其他的可执行文件,例如:自己制作的exe,或是 下载 安装的软件. 并打开指定路径下的文件
public static void openExe(String path) {
final Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec(path);
} catch (final Exception e) {
System.out.println("Error exec!");
}
}
public static void main(String[] args) throws IOException {
String path="E:\\noteapd++\\Notepad++\\notepad++.exe f:\\Sessions.txt";
openExe(path);
}