通过Java中的Process运行shell脚本

时间:2015-12-16 10:08:36

标签: java shell process

我试图将文件从Java Application Server移动到DB Server。为此,我使用shell脚本。要运行shell脚本,我使用Java文件中的Process。在使用putty在应用程序服务器中尝试作为独立的java(类文件)时,它正在转移到DB服务器。但是从应用程序尝试时,它不起作用,process.waitFor()正在返回1 ..需要帮助。???

代码:

Process p = Runtime.getRuntime().exec("sh "+asyncFilePath+"/ManualAdjFileTransfer.sh "+asyncFilePath+ " "+destPath+" "+ destUserId + " " + destIp + " " + asyncFilePath + " ManAdj_File_Transfer.Log");
p.waitFor()

1 个答案:

答案 0 :(得分:0)

这可能是一个许可问题:

electric-indent-mode

相关问题:Write an executable .sh file with Java for OSX

相关问题