📜  java 启动 exe - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:11.282000             🧑  作者: Mango

代码示例1
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;//our imports

public static void main(String[] args) throws IOException {
  String path = "/example:/example/example.exe/"; //the absolute path
  open(path); 
}

public static void open(String targetFilePath) throws IOException {
  Desktop desktop = Desktop.getDesktop();
  desktop.open(new File(targetFilePath));//open the file
}