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

急问Runtime.getRuntime().exec(command)相关有关问题?()

2012-03-09 
急问Runtime.getRuntime().exec(command)相关问题?()我在linux环境下调用一个程序,写法如下........Proces

急问Runtime.getRuntime().exec(command)相关问题?()
我在linux环境下调用一个程序,写法如下      
                ........        
                Process   process   =   null;
                BufferedReader   input   =   null;
                InputStreamReader   in   =   null;
                try   {
                        process   =   Runtime.getRuntime().exec( " ",   null,
                                                                                                new   File(strRootDir));
                        in   =   new   InputStreamReader(process.getInputStream());
                        input   =   new   BufferedReader(in);
                        process.waitFor();
                        return   process.exitValue();
                }   catch   (Exception   e)   {
                        e.printStackTrace();
                        return   1;
                }   finally   {
                      ............
                }
.......

[解决办法]
是环境变量和文本解释器的问题。
你可以写一个.sh文件取调用你的
lha ef /usr/local/mysearch/file/1111111111.lzh
在.sh文件第一行加上#!你的bash的位置。
如果你的bash在/bin/bash
你就写
#!/bin/bash就可以了
然后把需要的环境变量也加进去

热点排行