Tuesday, September 18, 2012

Internal browser issue in Eclipse Linux-GTK 3.7.2

After installing Eclipse 3.7.2 (Indigo SR2 release) on my Arch x86_64 + Xfce box, I was not able to use the internal web browser. I tried with several Eclipse bundles (C/C++, Java, JEE, and Classic) with the same result.

It turns out that Eclipse Framework is built upon SWT (which is an open source widget toolkit for java), and its internal browser is built using SWT's Browser Widget. To provide a multi platform high-level web browser layer, the browser widget can use different web browser engines as its underlying renderer. In the case of Eclipse Linux-GTK version, the supported browser engines are XULRunner (a library that allows Mozilla technologies to be embedded in other apps), and WebKitGTK+ (a GTK wrapper of the WebKit browser engine). If you installed Eclipse (regarding of which specific bundle) by downloading it from Eclipse's site, it is probable that you will need to install one of the browser engines supported by Eclipse as well.

After trying with every single library mentioned in the SWT Documentation, I found this bug report and finally was able to solve the problem. The thing is that, in the latest versions of WebKitGTK+, the libraries changed their name from libwebkit* to libwebkitgtk* and for some reason, SWT Browser widget for Eclipse 3.7.2 was not updated to search for the new names. By adding a symbolic link as shown below, this issue can be solved.

#ls -l /usr/lib/libweb*

lrwxrwxrwx 1 root root       26 Aug 31 00:23 /usr/lib/libwebkitgtk-1.0.so -> libwebkitgtk-1.0.so.0.13.4
lrwxrwxrwx 1 root root       26 Aug 31 00:23 /usr/lib/libwebkitgtk-1.0.so.0 -> libwebkitgtk-1.0.so.0.13.4
-rwxr-xr-x 1 root root 24632360 Aug 31 00:24 /usr/lib/libwebkitgtk-1.0.so.0.13.4

#sudo ln -s /usr/lib/libwebkitgtk-1.0.so.0.13.4 /usr/lib/libwebkit-1.0.so.2


P.S.
I decided not to use XULRunner because of its size and dependencies (in Arch repositories) are larger than the ones of WebKitGTK+.

Update 1.
I have recently tested Eclipse Juno and this issue is now fixed. You just need to tell SWT that you want to use webkit as you default native renderer by adding -Dorg.eclipse.swt.browser.DefaultType=webkit to your eclipse.ini file (more details in SWT's documentation).

Update 2 (Jun 27th, 2015).
As to Eclipse Mars, no extra configuration needed. Webkit is the default native renderer if none is explicitly specified (again, more details can be found in SWT's documentation).

No comments:

Post a Comment