SWT Browser & Eclipse
Asked Answered
A

6

9

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)
Alcantar answered 14/3, 2012 at 2:51 Comment(11)
You've probably already seen this thread, but you're not alone on this problem in Arch Linux: #7131480Beachlamar
And, out of extremely dumb, naive curiosity on my part, what versions of Eclipse and Mozilla Firefox do you have installed? Note the supported list of WebKit and Mozilla versions per version of Eclipse, in addition to the caveat about linkable Gecko libraries. Compiling Firefox yourself may actually resolve your problem: eclipse.org/swt/faq.php#browserlinuxBeachlamar
@MrGomez, I just saw this comment, I am using Firefox 11, hmm compile myself ... where do I get the sources? Its said that the one at mozilla does not fulfil the criteria?Alcantar
@MrGomez, do you happen to know if installing from the AUR is the same as compiling from source?Alcantar
It should be close enough for government work. And, it turns out the Mozilla Gecko SDK and XULRunner are one and the same now, so it's basically installing another version of XULRunner on your system to try. Failing this, if you're able to install libwebkit instead of libwebkit3 on your system and use the WebKit configuration options as before, that has a high success rate. Sorry for the trouble, in any event.Beachlamar
@MrGomez, no troubles, at least you helped alot. I think its just SWT/Java thats the problem... I compiled from source (the end of output). But I still get the same error ... I think the problem with webkit is the one from arch package manager is 1.6, which I think doesn't work?Alcantar
Hmm. Did you install SWT/Java to your system via make install or otherwise point to it? And, according to the documentation at least, Eclipse 3.7.2 supports newer versions of WebKit, so I don't think that's it. If you keep following the stack traces you receive, you'll get it.Beachlamar
@MrGomez, I installed SWT using Eclipse Update Site. I tried changing config to use webkit like: ./eclipse -vmargs "-Dorg.eclipse.swt.browser.DefaultType=webkit -Dorg.eclipse.swt.browser.UseWebKitGTK=true". I still get mozilla error. It really doesn't appear to be using that config isit?Alcantar
That, indeed, does not sound like it's using your options properly. I admit, at this point, that I'm stumped without privileged access to your machine, which I'm not about to ask for. For the sake of everyone reading this after us, we should roll this over to chat.Beachlamar
let us continue this discussion in chatBeachlamar
I was not able to reproduce your bug in my x86_64 Arch Linux VM after performing a full pacman --force -Syu. I installed all of the packages from here plus libwebkit and eclipse, building a default SWT Application Window. As mentioned, at this point, SWT64 or a 32-bit chroot are most appropriate. I'm still on chat for any other issues.Beachlamar
B
7

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.

Beachlamar answered 23/3, 2012 at 3:52 Comment(7)
Is it a problem if I am using GNOME 3 (its GTK3 I think, but GTK2 is installed too)? Also I put -Dorg.eclipse.swt.browser.XULRunneaarPath=/home/jiewmeng/xulrunner (xulrunner 1.9.2) in eclipse.ini but it still fails. I mis-spelt the option, eclipse still runs, is the config run at all?Alcantar
GNOME 3 isn't known to cause issues according to the documentation. Also to my understanding, the configuration changes you have made to eclipse.ini are parsed directly by the JVM used to run Eclipse, and in that capacity, misspelled options are discarded. The invocation will, indeed, need to be -Dorg.eclipse.swt.browser.XULRunnerPath to work effectively. If you wish to check if the ini is being ignored, consider passing this directly to eclipse as -vmargs, as here: help.eclipse.org/indigo/…Beachlamar
I tried ./eclipse -vmargs -Dorg.eclipse.swt.browser.XULRunnerPath=/home/jiewmeng/xulrunner, and I got the same error. The directory looks like i.imgur.com/h2HxL.png. I will update my original post on detailed environment & versions.Alcantar
Excellent, thank you. Now that we know your software versions, I can point you to this article, which includes a set of alternative workarounds and a patch. Do these work for you?Beachlamar
I think those are already what I tried (using a local xulrunner, use libwebkit). I think what might be the problem is the config doesn't appear to change anything? eg. when I set it to use webkit, it appears to be using MOZILLA still? Using a local xulrunner should work, but maybe its not using the right copy? Is ./eclipse -vmargs -Dorg.eclipse.swt.browser.XULRunnerPath=/home/jiewmeng/xulrunner right?Alcantar
It should be quoted (./eclipse -vmargs "-Dorg.eclipse.swt.browser.XULRunnerPath=/home/jiewmeng/xulrunner"), but otherwise, yes. Note that the code path subtly changes off trying to bind on Mozilla, in favor of binding to WebKit, when you include this option (according to your stack trace). Do also recall that a compile of Mozilla with the right Gecko extensions should also resolve this.Beachlamar
Answer updated. I got a full repro, and building xulrunner-1.9.2.19 from source, after making a few updates to its files to work with current library versions, got it to work.Beachlamar
M
3

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!
Monachism answered 21/2, 2013 at 16:27 Comment(0)
O
1

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

Oleaceous answered 25/7, 2017 at 11:22 Comment(0)
F
0

See browser QA in SWT FAQ

Farron answered 14/3, 2012 at 3:39 Comment(9)
I suppose I will end up eclipse.org/swt/faq.php#browserwebkitgtk. "WebKitGTK 1.2.0 or newer must be in the library load path" how will I do that? How do I know where webkitgtk is?Alcantar
On Ubuntu you can find a package via 'dpkg -l|grep <package-name>'. Then 'apt-file show libwebkitgtk-1.0-0' to find the path of libraries. I never use arch linux before, not sure how to find a package from it.Farron
What files do I need? Whats installed by pywebkitgtk is pastie.org/3591807.Alcantar
@JiewMeng See this answer. First of all, SWT requires libgtkwebkit, not pywebkitgtk. And Eclipse/SWT 3.6.x is only able to use WebKitGTK 1.2.x. If you are using newer WebKitGtk, try to use SWT 3.7.x.Farron
I edited my /usr/share/eclipse/eclipse.ini to have -Dorg.eclipse.swt.browser.DefaultType=webkit -Dorg.eclipse.swt.browser.UseWebKitGTK=true but nothing have changed. I still get the same error ... I believe I still dont know how to add the library load pathAlcantar
Looks like the libgtkwebkit is installed into default path of system library. You should find the path of libgtkwebkit in your system, then add the path into system env LD_LIBRARY_PATH or launch your application with vm argument -Djava.library.path=<xxx>Farron
@JiewMeng You can find swt webkit library(libswt-webkit-gtk-3740.so and libswt-webkit12-gtk-3740) from <your eclipse>/configuration/org.eclipse.osgi. Use ldd <path>/libswt-webkit-gtk-3740.so to check whether any library is missed or not.Farron
I dont see perhaps I am looking for these files in /usr/share/eclipse/plugins instead? I dont see that file in /configuration. Those are jar, tho ... ... zzz I am really hating Java ... will will users need to install such a embedable browser to use the application?Alcantar
You put eclipse under /usr/share, it means it's read-only for your running user(assuming it's not 'root'). So the running user can't modify the files under /usr/share/eclipse. Eclipse would create its runtime configuration under your home. And those libraries are a bridge between JAVA and native library of webkit, see the documentation of JNI for detail.Farron
A
0

MOZILLA_FIVE_HOME not set for eclipse pluging or any pluging gives unhandled error please do the follwoing process and you are done.

You may get a "MOZILLA_FIVE_HOME not set" error after you install eclipse color theme plugin in ubuntu 12.04. Here's a workround.

  1. Download and Install libhunspell-1.2-0 from here and install it.

    sudo dpkg -i libhunspell-1.2-0_1.2.14-4_amd64.deb
    
  2. Download and install xulrunner-1.9.2 from here and install it.

    sudo dpkg -i xulrunner-1.9.2_1.9.2.28+build1+nobinonly-0ubuntu0.11.04.1_amd64.deb

Adagio answered 5/7, 2012 at 5:6 Comment(0)
M
0

In Arch linux, based on the answer of @mrgomez and the FAQs provided installing:

# pacman -S webkitgtk2

solved the problem!

Thanks!

Monroemonroy answered 11/9, 2014 at 1:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.