使用Runtime类运行本地可执行文件

package jnet;

import java.io.File;

//使用Runtime类运行本地可执行文件对象
public class G {
    public static void main(String[] args) {
        try {
            Runtime rt = Runtime.getRuntime();  //创建执行本地文件对象
//            rt.exec("java F");
//            File file = new File("/F.java");
//            System.out.println(file.getPath());
//            rt.gc(); 调用垃圾回收器   
//            rt.exec("c:/windows/system32/calc.exe");  //调用windows系统自带的计算器
//            rt.exec("c:/windows/system32/cmd.exe");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

原文地址:https://www.cnblogs.com/nanfengnan/p/13849645.html