给大家一个在SERVER端执行可执行程序的JAVABEAN,呵呵~~~

发表于:2007-07-04来源:作者:点击数: 标签:
/* *Author:tyfun *DateTime:2002.12.19 *Package:com.westarsoft.function */ package com.westarsoft.io; import java .lang.*; import java.io.*; public class Execute { private static String cmdUrl = new String(); private static String fileParam
/*
*Author:tyfun
*DateTime:2002.12.19
*Package:com.westarsoft.function
*/

package com.westarsoft.io;

import java.lang.*;
import java.io.*;

public class Execute {
    private static String cmdUrl = new String();
    private static String fileParam = new String();
    public String getCmdUrl() {
        return cmdUrl;
    }
    public void setCmdUrl(String cmdUrl) {
        this.cmdUrl = cmdUrl;
    }
    public String getFileParam() {
        return fileParam;
    }
    public void setFileParam(String fileParam) {
        this.fileParam = fileParam;
    }
    /*
     *USE:
     *setCmdUrl(String)
     *setFileParam(String)
     */    
    public void exec(String cmdUrl,String fileParam) {
        try {
            String[] cmd = {cmdUrl, fileParam};
            Runtime.getRuntime().exec(cmd);
        }
        catch(Exception e) {
            System.out.println(e);
        }
    }
}

原文转自:http://www.ltesting.net