如何在 Eclipse for Mac 中将 Chrome 设置为默认外部浏览器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5322574/
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-10 20:03:23  来源:igfitidea点击:

How can I set Chrome as default external browser in Eclipse for Mac?

eclipsemacosgoogle-chromeide

提问by rubdottocom

I think that question is self-explained :-)

我认为这个问题是不言自明的:-)

When I browse to Application eclipse send me an error.

当我浏览到 Application eclipse 时向我发送一个错误。

采纳答案by Zoltán Ujhelyi

rubdottocom almost got it. The problem is, that the path contains spaces. If you write a new shell script with the following content:

rubdottocom 差点就搞定了。问题是,路径包含空格。如果你编写一个新的shell脚本,内容如下:

'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 

Eclipse can launch a new Chrome instance with it. Sadly, this way it is not possible to open a new tab in an already running instance, as the script exits with the following error message:

Eclipse 可以用它启动一个新的 Chrome 实例。遗憾的是,这种方式无法在已经运行的实例中打开新选项卡,因为脚本退出并显示以下错误消息:

[21043:2307:292361872340725:ERROR:process_singleton_mac.cc(102)]
    Unable to obtain profile lock.

回答by John Talbot

The simplest way to get Eclipse to recognize Chrome as the default system browser is :

让 Eclipse 将 Chrome 识别为默认系统浏览器的最简单方法是:

  1. Open Safari.
  2. Go to menu Safari > Preferences > General.
  3. Change 'Default web browser' to Safari.
  4. Close the Preferences dialog.
  5. Re-open the Preferences dialog.
  6. Change 'Default web browser' to Chrome.
  7. Close the Preferences dialog.
  1. 打开 Safari。
  2. 转到菜单 Safari > 首选项 > 常规。
  3. 将“默认网络浏览器”更改为 Safari。
  4. 关闭首选项对话框。
  5. 重新打开首选项对话框。
  6. 将“默认网络浏览器”更改为 Chrome。
  7. 关闭首选项对话框。

This solution is more general as it applies to any application which chooses the incorrect system browser. (thanks to Kelvin Lawrence at IBM)

此解决方案更通用,因为它适用于选择不正确系统浏览器的任何应用程序。(感谢 IBM 的 Kelvin Lawrence)

I am using Eclipse 4.2.0 on an iMac with OSX Mountain Lion. This also works for Eclipse Kepler on Mountain Lion.

我在装有 OSX Mountain Lion 的 iMac 上使用 Eclipse 4.2.0。这也适用于 Mountain Lion 上的 Eclipse Kepler。

回答by ufk

I posted the answer on another question like thison stackoverflow, so here it goes:

我在stackoverflow发布了另一个类似问题答案,所以这里是:

I found the solution in a blog's post that doesn't exist anymore, it involves configuring the Location to be '/usr/bin/open' and the parameter is '%URL%'.

我在不再存在的博客文章中找到了解决方案,它涉及将位置配置为“/usr/bin/open”,参数为“%URL%”。

You need to make sure that google chrome is your default browser and it will work properly. This is the only method that worked for me on OSX Lion.

您需要确保 google chrome 是您的默认浏览器并且它可以正常工作。这是在 OSX Lion 上对我有用的唯一方法。

回答by fcurella

I solved this by calling /usr/bin/open -a "/Applications/Google Chrome.app" <url>

我通过调用解决了这个问题 /usr/bin/open -a "/Applications/Google Chrome.app" <url>

回答by rubdottocom

Ooops! I find the answer here: Is there a way to add Google Chrome as an external web browser in Flash Builder Standalone for Mac?

哎呀!我在这里找到答案:有没有办法在 Flash Builder Standalone for Mac 中将 Google Chrome 添加为外部网络浏览器?

The exact location is: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

确切位置是:/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

It's annoying that you can't enter inside to an "Application folder" (AppName.app) through Finder :-S

您无法通过 Finder 进入“应用程序文件夹”(AppName.app),这很烦人:-S

Oh Wait! It's not working >_< Safari is opened

等一下!它不起作用 >_< Safari 已打开

回答by user3499819

you can also try to fix that from eclipse at the menu bar: windows->preferences->general->web browser-> select the radio, Use external web browser and choose your default browser from there. that simple.

您也可以尝试从 Eclipse 的菜单栏中修复该问题:windows->preferences->general->web browser-> 选择收音机,使用外部 Web 浏览器并从那里选择您的默认浏览器。就那么简单。

回答by Boris Brudnoy

Here's a helpful visual showing the /usr/bin/opentechinque:

这是显示/usr/bin/open技术的有用视觉效果:

enter image description here

在此处输入图片说明

回答by El Houcine

My method to set Chrome as a default browser in eclipse is: Go to Window >> Web browser and then select Chrome.

我在 Eclipse 中将 Chrome 设置为默认浏览器的方法是:转到 Window >> Web browser,然后选择 Chrome。

回答by Qrt

In Finder, right click on Google Chrome.app, select Show Package Contentsand browse down to Contents/Mac OSand drag Google Chrometo the Locationin Eclipse's Edit External Web Browserdialog box. Enter -url %URL%in the field Parameters. This worked for me on Eclipse Indigo on MacOS 10.7, at least when Chrome was not started before...

在 Finder 中,右键单击Google Chrome.app,选择Show Package Contents并向下浏览到Contents/Mac OS并将Google Chrome拖到Eclipse 的Edit External Web Browser对话框中的Location。在字段参数中输入-url %URL%。这在 MacOS 10.7 上的 Eclipse Indigo 上对我有用,至少在之前没有启动 Chrome 时......