ShellCommand_Java代码中执行shell脚本_Process的输入、输出、异常流都需要关闭(3)
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); } }