linux - SWT 浏览器和 Eclipse

标签 linux eclipse browser swt

在我的 Arch Linux、带有 Google Window Builder/SWT 应用程序的 Eclipse 上,我得到了

Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
    at org.eclipse.swt.SWT.error(SWT.java:4308)
    at org.eclipse.swt.browser.Mozilla.initMozilla(Mozilla.java:1826)
    at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:687)
    at org.eclipse.swt.browser.Browser.<init>(Browser.java:99)
    at octopus.EventSummaryComposite.<init>(EventSummaryComposite.java:33)
    at octopus.EventEditingComposite.<init>(EventEditingComposite.java:45)
    at octopus.EventManagementController.<init>(EventManagementController.java:31)
    at octopus.MainController.<init>(MainController.java:38)
    at octopus.MainController.main(MainController.java:85)

我认为我需要安装 XULrunner 或其他东西。但是当我在 Arch 中安装 xulrunner 时,我得到 xulrunner and eclipse are in conflict。所以我尝试安装 pywebkitgtk。然后我将 -Dorg.eclipse.swt.browser.DefaultType=webkit 添加到 /usr/bin/eclipse/usr/share/eclipse/eclipse.ini 不确定使用哪个。但是当我运行时,我仍然得到同样的错误。看来 webkit 仍未使用。我该如何解决这个问题?

更新 2

到目前为止,我尝试安装 libwebkit3。然后将 -Dorg.eclipse.swt.browser.UseWebKitGTK=true 添加到 /usr/share/eclipse/eclipse.ini,我得到了同样的错误。

然后我也尝试下载解压xulrunner from mozilla~/xulrunner 并添加 -Dorg.eclipse.swt.browser.XULRunnerPath=/home/jiewmeng/xulrunner/ 配置,还是一样的错误...

刚才在Ubuntu中,我刚刚安装了xulrunner就可以了……我想知道配置是否被使用了?

Arch Linux Question

更新(环境和版本)

  • Arch Linux
  • GNOME 3
  • eclipse 3.7.2
  • SWT 1.3.0/3.7.2 (http://dl.google.com/eclipse/inst/d2wbpro/latest/3.7)
  • XULRunner 1.9.2.19 (http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.2.19/)
  • Firefox 11(来自 pacman)

如果您需要其他相关信息,请告诉我

更新(旧)

如果我将代码更改为

new Browser(this, SWT.WEBKIT)

我明白了

Exception in thread "main" org.eclipse.swt.SWTError: No more handles
    at org.eclipse.swt.SWT.error(SWT.java:4308)
    at org.eclipse.swt.SWT.error(SWT.java:4197)
    at org.eclipse.swt.SWT.error(SWT.java:4168)
    at org.eclipse.swt.browser.Browser.<init>(Browser.java:103)
    at octopus.EventSummaryComposite.<init>(EventSummaryComposite.java:33)
    at octopus.EventEditingComposite.<init>(EventEditingComposite.java:45)
    at octopus.EventManagementController.<init>(EventManagementController.java:31)
    at octopus.MainController.<init>(MainController.java:38)
    at octopus.MainController.main(MainController.java:85)

最佳答案

根据编辑过的问题和所有勘误表,明显的问题似乎是您运行的 Eclipse 版本与系统上安装的 Mozilla 或 WebKit 版本之间的版本冲突。这由 extremely terse documentationdependency hell 进一步合并。

关键是检查您运行的 Eclipse 版本并将其与系统上安装的 xulrunnerlibwebkit 的版本进行比较,完全按照答案和勘误表 here 中的建议并记录在常见问题解答 here 中。但是,基于您遇到的困难和关于此问题的稀疏文档,您需要采取特殊的预防措施以确保您的所有依赖项都满足严格正确的版本。

鉴于您对 xulrunner 和 eclipse 存在冲突 的诊断,我进行了一些挖掘以找到解决此问题的正确方法。事实证明,这在 this thread 中有详细介绍。您需要关注的重要信息:

  • Eclipse 3.5.2-3.6.x 与 xulrunner 2.0 不兼容。如果这是较旧的系统,请使用 xulrunner 1.9.2-15-2 来解决问题。

  • 您使用的 Eclipse 版本很可能不支持 libwebkit3。如前所述,您极有可能需要使用早期版本。

  • 在所有情况下,构建具有正确 Gecko 绑定(bind)的 Firefox 版本应该可以解决问题,事实上,当这些绑定(bind)不存在时会重现此错误:

Also note that a Firefox release whose contained Gecko version correlates with the Mozilla versions above can also be used with Eclipse 3.1 and newer (Linux only), provided that it has been compiled with linkable Gecko libraries. It is important to note that Firefox downloads from mozilla.org do not satisfy this criteria, but Firefox installations that are included in major Linux distributions often do in the absence of a XULRunner installation. Attempting to use a Firefox install without linkable Gecko libraries will throw an error with message "No more handles [NS_InitEmbedding...error -2147221164]".

简而言之:问题在于 Arch Linux 对 Eclipse SWT 依赖项的打包。但是,这是一个已有一年之久的问题,表明您的 Eclipse 版本和系统的其余部分迫切需要软件升级...:)


编辑:为了获得在 Arch Linux 中工作的 SWT 浏览器小部件的 Google WindowBuilder Pro 副本,我创建了一个 VM 并使用 OP 逐步完成了这个过程。我能够在 32 位和 64 位版本的 Arch Linux 中重现该错误。

事实证明 Arch Linux 对 libwebkit 的绑定(bind)不足,所以我继续构建 xulrunner-1.9.2.19 from source 。在 whole lot necessary fixups 之后,我的 make install 版本只适用于 Eclipse。

下一步,任何愿意的人,都可以将此报告给 Ar​​ch Linux。

关于linux - SWT 浏览器和 Eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695271/

相关文章:

ruby - 用 Ruby 做原生 GUI

browser - UiPath:无法找到与此选择器对应的 UI 元素

javascript - JQuery 取消输入的文本

javascript - ERROR 403 (Forbidden) 当 HTML 包含 CSS 和 JS 等资源时

java - 如何使用已部署的 QVTo Eclipse 插件

java - 使用 setToolTip() 方法更改后,操作上的按键绑定(bind)工具提示消失

linux - Bash:使用参数扩展查找和替换

c++ - OpenCV 3.1 升级导致 Linux 上的链接器错误

linux - 什么是 moby 运行时?

java - Maven POM 编辑器 : Dependency Graph missing