如何使用工作区路径名从 MacOS 上的命令行启动 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1783409/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:09:45  来源:igfitidea点击:

How to launch eclipse from a command line on MacOS with a workspace pathname

eclipsemacos

提问by bmargulies

On linux:

在 Linux 上:

eclipse PathnameToWorkspace

works fine, and launches eclipse on the workspace.

工作正常,并在工作区上启动 eclipse。

I've never been able to figure out the MacOS moral equivalent, given the MacOS application tree structure.

考虑到 MacOS 应用程序树结构,我一直无法弄清楚 MacOS 的道德等价物。

I suspect this is not a hard problem.

我怀疑这不是一个困难的问题。

采纳答案by Fabian Steeg

./eclipse -data <workspace-path>(see also How do I run Eclipsein the Eclipse Wiki).

./eclipse -data <workspace-path>(另请参阅Eclipse Wiki 中的如何运行 Eclipse)。

回答by zrajm

On my system there's a link to the eclipse binary from /Applications/eclipse/eclipse, and I find that just running that will start Eclipse with my default workspace.

在我的系统上,有一个指向 eclipse 二进制文件的链接/Applications/eclipse/eclipse,我发现只要运行它就会使用我的默认工作区启动 Eclipse。

You might also find the Eclipse binary in '/Applications/Eclipse.app/Contents/MacOS/eclipse'.

您还可以在“/Applications/Eclipse.app/Contents/MacOS/eclipse”中找到 Eclipse 二进制文件。

When I start Eclipse like this (from the command line) I find that my Mac will not always switch to the desktop where Eclipse is started, so that I will have to go hunt for the Eclipse window with Exposé/Misson Control (Ctrl-Up Arrow). – This is especially true when I'm have two monitors connected to my Mac.

当我像这样(从命令行)启动 Eclipse 时,我发现我的 Mac 不会总是切换到启动 Eclipse 的桌面,因此我将不得不使用 Exposé/Misson Control (Ctrl-Up箭)。– 当我有两台显示器连接到我的 Mac 时尤其如此。

Since I found typing the full path to eclipse annoying, I simply added a symlink to it from /opt/local/binand made sure that directory is in my $PATH:

因为我发现输入 eclipse 的完整路径很烦人,所以我只是添加了一个符号链接,/opt/local/bin并确保该目录在我的$PATH

cd /opt/local/bin
sudo ln -s /Applications/eclipse/eclipse .
echo 'PATH="$PATH:/opt/local/bin' >>~/.bashrc

After that, just issuing the command eclipse(without the preceding /Applications/eclipsepart) works as it should.

之后,只需发出命令eclipse(没有前面的/Applications/eclipse部分)就可以正常工作。

回答by Jason D

On my Mac running High Sierra the Eclipse Binary was located in /Users/<username>/eclipse/<tool-chain-version>/Eclipse.app/Contents/MacOS/

在我运行 High Sierra 的 Mac 上,Eclipse 二进制文件位于 /Users/<username>/eclipse/<tool-chain-version>/Eclipse.app/Contents/MacOS/

Where the tool-chain-version is the specific version of Eclipse that was installed, in my case it was javascript-2018-12. I believe they follow this pattern, for example j2ee-2019-01.

工具链版本是安装的 Eclipse 的特定版本,在我的例子中是 javascript-2018-12。我相信他们遵循这种模式,例如 j2ee-2019-01。

Running the eclipse binary in that directory starts eclipse from the command line.

在该目录中运行 eclipse 二进制文件会从命令行启动 eclipse。