姬長信(Redy)

linux – xterm没有找到shell的绝对路径


我正在尝试使用ProcessBuilder从Java在SUSE Linux Enterprise 12中运行脚本.代码如下:
ProcessBuilder pb = new ProcessBuilder("xterm", "-e", "script_path");
Process pr = pb.start();

然后我读取了来自Process的消息,它是在说xterm:找不到shell的绝对路径:script_path

所以我尝试从SUSE中的Gnome-Terminal,并使用命令xterm script_path但发现了相同的错误消息.我尝试了表单root和本地用户.我完全没有关于这个错误的线索.

主要条件是我必须能够以root身份运行此代码,因为我的java代码必须仅以root身份调用.

更新:

我再次尝试过,现在我实际上有一个来自ProcessBuilder的新错误消息.我从错误流中得到的消息如下:

error extracting:: error message: Warning: This program is an suid-root program or is being run by the root user. 
The full text of the error or warning message cannot be safely formatted in this environment. 
You may get a more escriptive message by running the program as a non-root user or by removing the suid bit on the executable. 
xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set

我试图执行的脚本是unZipper.sh:

#!/bin/bash
sudo unzip -o postgresql-9.4.6-linux-64.zip -d some_path/db/
sleep 3