首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

ShellCommand_Java代码中执行shell脚本_Process的输入、输出、异常流都需要关闭(3)

2012-10-31 
ShellCommand_Java代码中执行shell脚本_Process的输入、输出、错误流都需要关闭(3)public static void execu

ShellCommand_Java代码中执行shell脚本_Process的输入、输出、错误流都需要关闭(3)

public static void executeWithoutResult(String shellFile)    {        //脚本文件为NULL或空值        if (null == shellFile || shellFile.equals(""))        {            logger.warn("ShellCommand shellFile is null.");            return;        }                if (logger.isDebugEnabled())        {            logger.debug("bash " + shellFile);        }                try        {            Runtime.getRuntime().exec("bash " + shellFile);        }        catch (Exception e)        {            logger.error("Execute " + shellFile + " exception:", e);        }    }

热点排行