eclipse 有没有办法在 Flash Builder Standalone for Mac 中将 Google Chrome 添加为外部网络浏览器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3304854/
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
Is there a way to add Google Chrome as an external web browser in Flash Builder Standalone for Mac?
提问by Kevin Suttle
It currently seems impossible to add Google Chrome as an external web browser in Flash Builder Standalone for Mac. In this context, Eclipse only cares about "Unix executables" and not .app files.
目前似乎不可能在 Flash Builder Standalone for Mac 中将 Google Chrome 添加为外部 Web 浏览器。在这种情况下,Eclipse 只关心“Unix 可执行文件”而不是 .app 文件。
For example, the path to Firefox on a Mac is: /Applications/Firefox.app/Contents/MacOS/firefox-binwhich is only found by right-clicking and choosing 'Show Package Contents' on Firefox.app in your Applications directory.
例如,Mac 上 Firefox 的路径是:/Applications/Firefox.app/Contents/MacOS/firefox-bin只能通过右键单击并在应用程序目录中的 Firefox.app 上选择“显示包内容”来找到。
If you try to add Google Chrome as a new external web browser, you'll have to repeat this process to navigate to /Applications/Google Chrome.app/Contents/MacOSwhere the 'Google Chrome' Unix exxecutable resides.
如果您尝试将 Google Chrome 添加为新的外部 Web 浏览器,则必须重复此过程以导航到“Google Chrome”Unix 可执行文件所在的/Applications/Google Chrome.app/Contents/MacOS。
The problem is that space in the name. If you attempt to click OK in Eclipse, you'll get an error preventing you from continuing:
问题在于名称中的空格。如果您尝试在 Eclipse 中单击“确定”,则会收到一个错误,阻止您继续:
The location value is not a valid path name
位置值不是有效的路径名
Are there any workarounds for this so I can use Chrome as my development browser only? I did some searching and all I could come up with was this:
是否有任何解决方法,以便我只能将 Chrome 用作我的开发浏览器?我做了一些搜索,我能想到的是:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297273
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297273
UPDATE: A kind and savvy Flash Builder engineer gave me a helpful tip. Note that you'll need to show hidden files in Mac, by opening Terminal and entering the following command:
更新:一位善良而精明的 Flash Builder 工程师给了我一个有用的提示。请注意,您需要在 Mac 中显示隐藏文件,方法是打开终端并输入以下命令:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Press Return to relaunch Finder. Once hidden files are shown, "You'll find what you need in [YOUR WORKSPACE]/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs. There's a 'browsers' property there that defines XML for defining Eclipse's web browsers. Add a new browser location and name and restart Flash Builder."
按 Return 重新启动 Finder。显示隐藏文件后,“您将在 [您的工作区]/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs 中找到您需要的内容。有一个 '浏览器的属性在那里定义了用于定义 Eclipse 的 Web 浏览器的 XML。添加一个新的浏览器位置和名称并重新启动 Flash Builder。”
In this case you'd add:
在这种情况下,您将添加:
<external location\="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" name\="Google Chrome"/>\n
I can confirm that this works. Hopefully we won't have to resort to this kind of hackery on the next go around.
我可以确认这有效。希望我们下次不必求助于这种黑客。
回答by Caspar Harmer
You can do this from the UI in FB 4.5 - However, you need this exact path (unquoted and unescaped) in Preferences->Web Browser. Select "Use External Browser" and add the line below as the location (You may not need the 'name\="Google Chrome" bit, but looks like it worked all in one line for me):
您可以从 FB 4.5 中的 UI 执行此操作 - 但是,您需要在首选项-> Web 浏览器中使用此确切路径(未加引号和未转义)。选择“使用外部浏览器”并添加下面的行作为位置(您可能不需要“名称\="谷歌浏览器”位,但看起来它对我来说都是在一行中工作的):
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" name\="Google Chrome
回答by J.D.
You could create an executable here: /usr/local/bin/chrome with these contents:
您可以在此处创建一个可执行文件:/usr/local/bin/chrome,其中包含以下内容:
#!/bin/sh
open -a 'Google Chrome' &
And then ensure Chrome's Preferences settings for "Web Browser" are this for external web browser "Google Chrome":
然后确保 Chrome 的“网络浏览器”首选项设置是外部网络浏览器“Google Chrome”的:
Name: Google Chrome
Location: /usr/local/bin/chrome
Parameters: %URL%
回答by Youval Bronicki
Update
更新
As of Eclipse 4.3.1, the script approach (below) no longer works, but the simpler option of simply selecting "Google Chrome.app" as an external browser (using Eclipse UI) is fixed.
从 Eclipse 4.3.1 开始,脚本方法(如下)不再有效,但简单地选择“Google Chrome.app”作为外部浏览器(使用 Eclipse UI)的更简单选项已修复。
Old (obsolete) answer
旧(过时)答案
My workaround was to create a shell script that opens Chrome (see below), and point Eclipse to this script. In this way Chrome is opened with 2 tabs - the home page and the requested page - but this was good enough for me.
我的解决方法是创建一个打开 Chrome 的 shell 脚本(见下文),并将 Eclipse 指向这个脚本。通过这种方式,Chrome 使用 2 个选项卡打开 - 主页和请求的页面 - 但这对我来说已经足够了。
#! /bin/sh
open /Applications/Google\ Chrome.app $*
回答by Chris G.
You need the path to the Unix Executable file of Google Chrome.
您需要 Google Chrome 的 Unix 可执行文件的路径。
How to:
如何:
- in Finder, right click Google Chrome.app "Show Package Content".
- Navigate down to Content/MacOS
- cmd + i and copy the path to the Unix Executable File
- In Eclipse Preferences Web Browser / Location, "brows.."
- Paste in the path to the Unix Executable.
- 在 Finder 中,右键单击 Google Chrome.app“显示包内容”。
- 向下导航到内容/MacOS
- cmd + i 并将路径复制到 Unix 可执行文件
- 在 Eclipse Preferences Web Browser/Location 中,“brows..”
- 粘贴到 Unix 可执行文件的路径中。
The path, something like: /Applications/Google Chrome.app/Contents/MacOS
路径,类似于:/Applications/Google Chrome.app/Contents/MacOS
Location: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome Parameters: -sandbox
位置:/Applications/Google Chrome.app/Contents/MacOS/Google Chrome 参数:-sandbox
回答by moriak
For me worked with the following configuration:
对我来说,使用以下配置:
Location: /usr/bin/open
Parameters: -a "Google Chrome.app" %URL%
位置:/usr/bin/open
参数:-a "Google Chrome.app" %URL%
回答by John Talbot
The simplest way to get Flash Builder Standalone for Mac to recognize Chrome as the default system browser is
让 Flash Builder Standalone for Mac 将 Chrome 识别为默认系统浏览器的最简单方法是
- Open Safari
- Go to menu Safari > Preference > General
- Change 'Default web browser' : Safari
- Change 'Default web browser' : Chrome
- Close Safari
- 打开 Safari
- 转到菜单 Safari > 首选项 > 常规
- 更改“默认网络浏览器”:Safari
- 更改“默认网络浏览器”:Chrome
- 关闭 Safari
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)
回答by ufk
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%
.
我在不再存在的博客文章中找到了解决方案,它涉及将 Location 配置为 be/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 Jed Schneider
/Applications/Google\ Chrome.app/Contents/MacOS
escape the space in the path to the google chrome executable. OS X only cares about unix executables, because its posix based as well, it doesn't actually have much to do with eclipse.
转义谷歌浏览器可执行文件路径中的空间。OS X 只关心 unix 可执行文件,因为它也基于 posix,它实际上与 eclipse 没有太大关系。