Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SWT Browser & Eclipse

On my Arch Linux, Eclipse with Google Window Builder/SWT application, I am getting

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)

I believe I need to install XULrunner or something. But when I install xulrunner in Arch, I get xulrunner and eclipse are in conflict. So I tried installing pywebkitgtk. Then I added -Dorg.eclipse.swt.browser.DefaultType=webkit to /usr/bin/eclipse and /usr/share/eclipse/eclipse.ini not sure which is used. But when I run, I still get the same error. It appears webkit is still not used. How can I fix this?

UPDATE 2

So far I tried installing libwebkit3. Then added -Dorg.eclipse.swt.browser.UseWebKitGTK=true to /usr/share/eclipse/eclipse.ini, I get the same error.

Then I also tried downloading and extracting xulrunner from mozilla to ~/xulrunner and adding -Dorg.eclipse.swt.browser.XULRunnerPath=/home/jiewmeng/xulrunner/ to config, still same error...

In Ubuntu just now, I just installed xulrunner and it worked... I wonder if the config is even used?

Arch Linux Question

UPDATE (Environment & Versions)

  • 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 (from pacman)

Let me know if you need other relavent info

UPDATE (Old)

If I change my code to

new Browser(this, SWT.WEBKIT)

I get

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)
like image 681
Jiew Meng Avatar asked Mar 14 '12 02:03

Jiew Meng


3 Answers

The apparent problem, in accordance with the edited question and all of the errata, appears to be a version conflict between your running version of Eclipse and the versions of both Mozilla or WebKit installed on your system. This is further conflated by extremely terse documentation and dependency hell.

The key is to check your running Eclipse version and compare it to the versions of xulrunner and libwebkit installed on your system, exactly as recommended in the answer and errata here and documented in the FAQ here. However, based on the difficulties you've had and the sparse documentation on this problem, you'll want to take special precautions to ensure that all of your dependencies are satisfied for the strictly correct versions.

Given your diagnosis that xulrunner and eclipse are in conflict, I did some digging to find the correct resolution to this problem. It turns out this is covered in extensive detail in this thread. The salient information you need to be concerned about:

  • Eclipse 3.5.2-3.6.x are incompatible with xulrunner 2.0. If this is an older system, use xulrunner 1.9.2-15-2 to solve the problem.

  • The version of Eclipse you are using very likely does not support libwebkit3. As mentioned, it is exceedingly likely that you will need to use an earlier version.

  • In all cases, building a version of Firefox with the correct Gecko bindings should resolve the issue and, as point of fact, reproduces this bug when those bindings are not present:

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]".

In short: the problem is with Arch Linux's packaging of the dependencies for Eclipse SWT. But, this is a year-old issue that indicates your Eclipse version and the rest of your system is in desperate need of a software upgrade... :)


Edit: To get Google WindowBuilder Pro's copy of SWT's browser widgets working in Arch Linux, I created a VM and stepped through this process with the OP. I was able to reproduce the bug in both the 32- and 64-bit versions of Arch Linux.

It turns out Arch Linux's bindings for libwebkit were insufficient, so I went ahead and built xulrunner-1.9.2.19 from source. After a whole lot of necessary fixups, my make install version just works with Eclipse.

The next step, for anyone willing, is to report this to Arch Linux.

like image 200
MrGomez Avatar answered Oct 23 '22 03:10

MrGomez


This steps worked for me with STS 2.9.2 based on Eclipse 3.7.2 (Ubuntu 12.04 - 64bits):

  1. Install Google plugin for Eclipse using this update site: http://dl.google.com/eclipse/plugin/3.7. I just wanted to use GWT, so I only checked "Google plugin for Eclipse", "GWT Designer for GPE" and "SDKs".
  2. Restart Eclipse and verify that trying to design a GWT UIBinder view with WindowBuilder fails showing an error related to xulrunner.
  3. Close Eclipse.
  4. Install required packages (inspired by http://elgali.net/2012/05/14/gwt-designer-eclipse-plugin-in-ubuntu-12-04/)
    • sudo apt-get install libicu48
    • sudo apt-get install libwebkitgtk-1.0-common
    • sudo apt-get install libwebkitgtk-1.0-0
  5. Start Eclipse again and check that WindowBuilder Desing view works!
like image 39
cfillol Avatar answered Oct 23 '22 02:10

cfillol


In my case I just had to install libwebkitgtk-1.0-0:

sudo apt-get install libwebkitgtk-1.0-0

Info on my machine:

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:        16.10
Codename:       yakkety

See also: https://rusya7.blogspot.com.es/2013/07/eclipse-internal-browser-is-not.html

like image 35
Campa Avatar answered Oct 23 '22 04:10

Campa