读书人

java运作可以执行文件

发布时间: 2012-11-05 09:35:12 作者: rapoo

java运行可以执行文件

# package com.yymt.pf.rpc.loadbalance;  #   # import java.io.File;  # import java.io.IOException;  #   # public class ExecFileUtil {  #     public static void main(String[] args) throws IOException {  #         run("cmd /C start startup.bat", null, new File(  #                 "E:\\develop_tools\\apache-tomcat-6.0.26\\bin\\"));  #         System.out.println("Started!");  #     }  #   #     /** #      * @param path #      *            a specified system command #      * @param envp #      *            array of strings, each element of which has environment #      *            variable settings in the format name=value, or null if the #      *            subprocess should inherit the environment of the current #      *            process. #      * @param dir #      *            the working directory of the subprocess, or null if the #      *            subprocess should inherit the working directory of the current #      *            process. #      * @return #      * @throws IOException #      */  #     public static Process run(String cmd, String[] envp, File dir)  #             throws IOException {  #         Runtime rt = Runtime.getRuntime();  #         return rt.exec(cmd, envp, dir);  #     }  #   # } 
?

读书人网 >编程

热点推荐