简体   繁体   中英

execute exe file through ecec() and then send the console (.exe) in background

i want to run a specified file (.exes) in background...

File file = new File ("C:\\Documents and Settings\\INTEL\\My Documents\\NetBeansProjects\\demo\\calc.exe");  
Desktop.getDesktop().open(file);  

what if i use Runtime stuff

在单独的过程中执行指定的字符串命令。

Process process = Runtime.getRuntime().exec("C:\\Documents and Settings\\INTEL\\My Documents\\NetBeansProjects\\demo\\calc.exe");

You could execute your process in another thread

Thread thread = new Thread(){
  public void run(){
    try {
      Runtime.getRuntime().exec("...");
    } catch (Exception e) { ... }
  }
}
thread.start();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM