使用 Runtime.getRuntime().exec 打开一个 bat 文件

时间:2021-06-11 12:37:16

标签: java eclipse batch-file script

try {
    Process p = Runtime.getRuntime().exec("cmd /c start " +Main.class.getResource("/res/ActivateWindows.bat"));

    JOptionPane.showMessageDialog(null, "Opération réussie","Activation Windows 10",1);
} catch (IOException e1) {
    e1.printStackTrace();
}

大家好,这是我的代码,它适用于 Eclipse,但是当我在 .jar 中导出时,我的应用程序会启动,但是当我点击按钮时,会出现一个窗口“您需要​​一个新的 .jar 应用程序”帮助我

0 个答案:

没有答案
相关问题