![](/img/trans.png)
[英]how to launch a shell script in a new gnome terminal, from a java program
[英]How do you launch a shell script from ant on a Mac?
在linux上类似:
<target name="runDo">
<exec executable="gnome-terminal" spawn="true">
<arg line="-t 'Title' --geometry=120x80 -e '/script/path/bin/do.sh'"/>
</exec>
</target>
工作正常。
我试过通过macports安装xterm,gnome-terminal和rxvt并类似地运行它们,但没有结果,以及/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -e,但似乎没有任何作用。 我还尝试过将脚本作为可执行文件的属性值运行,希望操作系统能够选择合适的应用程序来启动,但并不高兴。
我可以在不产生新终端的情况下使它运行,但是我正在从IDE运行ant任务,并且希望在退出IDE或关闭项目以打开另一个项目时使其保持活动状态。 救命?
刚与xterm一起...
<target name="startTomcat_DebugLinux" if="isLinux">
<exec executable="gnome-terminal" spawn="true">
<arg line="--window-with-profile=Tomcat --geometry=120x60 -e '${env.CATALINA_HOME}/bin/catalina.sh jpda run'" />
</exec>
</target>
<target name="startTomcat_DebugMac" if="isMac">
<exec executable="/usr/X11R6/bin/xterm" spawn="true">
<arg line="-geometry 180x65 -e ${env.CATALINA_HOME}/bin/catalina.sh jpda run" />
</exec>
</target>
以前的问题,open -a无法解决的问题是,我无法获取参数jpda并运行传递给脚本。 open需要一个--args,但是args似乎传递给了终端而不是脚本。 欢迎使用其他解决方案,但这现在对我有用。
尝试open -a Terminal /script/path/bin/do.sh
。
您应该只能够在/ bin / sh上运行它,并使它与ant输出内联。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.