[英]java can't run command line application
I am developing an application that will run a command line application from a Java interface. 我正在开发一个将从Java界面运行命令行应用程序的应用程序。 This app used to work on my fedora but now under Ubuntu I get this message:
这个应用程序过去可以在我的fedora上运行,但是现在在Ubuntu下,我收到以下消息:
Error opening terminal: unknown.
打开终端时出错:未知。
I am starting the application using this command: 我正在使用以下命令启动应用程序:
Process clientProcess = Runtime.getRuntime().exec(clientcommand);
where clientcommand is a string that contains the command to be run. 其中,clientcommand是包含要运行的命令的字符串。 also please note that when I copy and paste the command directly to the console the program runs as supposed.What am I doing wrong?
还请注意,当我直接将命令复制并粘贴到控制台时,程序将按预期运行。我在做什么错? is there an issue with running a command this way?
这样运行命令是否存在问题?
I know why this is happening, but I may not have a solution for you. 我知道为什么会这样,但是我可能没有适合您的解决方案。 But lets see...
但是让我们看看...
I had this same problem on OSX. 我在OSX上遇到了同样的问题。 I was running .sh scripts form Jenkins.
我正在运行Jenkins的.sh脚本。 I would get this error.
我会得到这个错误。 It turns out the issue is it doesn't know where or which terminal you want to use.
事实证明,问题在于它不知道要在哪里使用哪个终端。 Since Jenkins was sudo'ing as me, i went to my .bashrc and defined export TERM=xterm .
由于詹金斯(Jenkins)和我在一起时很生气,所以我进入了.bashrc并定义了export TERM = xterm。 That did the trick.
做到了。
So now i have a situation where I'm developing a grails app and the same problem is occurring... but i dont know how to set the xterm for grails... as it isn't running as me. 所以现在我遇到了一种情况,我正在开发grails应用程序,并且发生了相同的问题...但是我不知道如何为grails设置xterm ...因为它没有像我一样运行。
But anyway, the issue is your system doesn't know which terminal to use... or how to reach it. 但是无论如何,问题是您的系统不知道要使用哪个终端...或如何连接它。 By specifying your terminal it should work.
通过指定您的终端,它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.