Process proc = Runtime.getRuntime().exec(command);[@more@]import java.io.BufferedReader;import java.io.IOException;impor
Process proc = Runtime.getRuntime().exec(command);
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CallExe {
public static void main(String[] args) {
String text = null;
String command = "C:Program FilesYodaoDeskDictRunDict.exe";//exe,bat文件名OR DOS命令
try {
Process proc = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while ((text = in.readLine())!= null) {
System.out.println(text); //输出测试
}
} catch (IOException ioError) {
ioError.printStackTrace();
System.exit(0);
}
}
--结束END--
本文标题: Java执行exe,bat等可执行文件
本文链接: https://lsjlt.com/news/232213.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0