在我的PC上,我可以运行eclipse -clean
,但在我的Mac上,可执行文件是Eclipse.app--如何在命令行上带参数运行它?
open -a Eclipse.app --args <your arguments>
eclipse.app
的目录。在该目录下进入 Eclipse.app\Contents\MacOS
目录,应该会看到一个名为 eclipse
的可执行文件。-clean
参数的 eclipse
可执行文件来启动 Eclipse,如下所示:
./eclipse -clean
这里有一个使用MacPorts自动重启的脚本。您可以将此脚本放在桌面上,以便双击运行。
#!/bin/bash
# WF 2014-03-14
# start Eclipse cleanly
pgrep -fl Eclipse.app
if [ $? -eq 0 ]
then
echo "Eclipse is running - shall i kill and restart it with -clean? y/n?"
read answer
case $answer in
y|Y) ;;
*) echo "ok - I'm aborting this ..."
exit 1;
;;
esac
echo "killing current eclipse"
pkill -f Eclipse.app
fi
echo "starting eclipse cleanly ..."
/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean -clearPersistedState&
大家好。如果您有路径,那么命令行将按照上述方式工作得很好。否则,请导航到Eclipse的封闭文件夹,然后进入Eclipse.app并执行以下操作:
./eclipse -clean -vmargs -XstartOnFirstThread
这不会让您的命令窗口正常退出,因此在执行完毕后,您必须关闭命令窗口。
(但是为了确保,清理并不总是有效的。)
编辑:我应该在第二天编辑这个!它炸掉了我的工作区 - 主要是由于共享命令。各种错误。
我解决问题的方法(而不是重新安装):我恢复了几天前整个Eclipse目录的备份,并刷新了项目。这需要一些努力。不太美观。
./eclipse -clean
,它就会运行。 - Jason S./eclipse -clean -refresh
。该参数将刷新Eclipse工作区中的资源。 - sulai