我想从Java发送下面的命令成功在linux从Java发送命令到Linux
此命令改变hylafax为发送传真 调制解调器,并运行此命令在Linux的shell 但是当它与Java运行如下:
modemcommand = "[email protected]";
InputStreamReader isr = null;
try {
isr = new InputStreamReader(Runtime.getRuntime().exec(modemcommand).getInputStream());
System.out.println("The Command : "+modemcommand+" is running successfull!");
} catch (IOException ex) {
System.out.println("The Command : "+modemcommand+" is not running successfull!");
System.out.println("Error on switch to modem : "+Modem+" :--> "+ex.toString());
System.out.println("--------------------------------------------------------------");
}
输出为:误差= 2:没有这样的文件或目录 有人能帮助我吗?
2013-11-25
Tishk
+0
这只是一个命令,当某些shell解释时,所以你的意思是'sh FAXSERVER = ...';但是这可能仍然不能解决你的问题,因为环境变量的作用域是shell进程(没有全局设置)。 –