Writer writer = null; 
    String filePath = null; 
    try{ 
filePath = "/path/"; 
writer = new BufferedWriter(new FileWriter(new File(filePath + "export.sh"))); 
    }catch(Exception e) { 
    }     try { 
        writer.write("gzip transums_file.del;\n"); 
        if (writer != null) { 
            writer.close(); 
        } 
        } catch (Exception e) { 
        } 
String cmd = "sh " + filePath + "export.sh"; 
        try 
        { 
            String outStr = ""; 
            // 执行CMD; 
            Process p = Runtime.getRuntime().exec(cmd); 
            p.waitFor(); 
            InputStream processIn = p.getInputStream(); 
            if (processIn != null){ 
                for (int ch = 0;(ch = processIn.read()) != -1;){ 
                    outStr += (char) ch; 
                } 
            } 
            out.println(outStr); 
        }catch(Exception e){ 
            out.println(e.toString()); 
        } 
上面这一段脚本调用死活不起作用 前面一段生成的脚本 在命令行执行一点问题没有 但用Runtime.getRuntime().exec(cmd);调用就不起作用 求大家帮忙看看 谢了