When troubleshooting Eclipse bugs, I sometimes ask if you are running eclipse on gtk2 or gtk3.
Usually I can tell visually if Eclipse is running on Gtk2 or Gtk3, but this changes depending on your system theme.
In the about section
As Alexander Kurtakov pointed out and described in Lar’s article ,
Help -> About -> Installation Details -> Configuration Tab.
Look for something like:
org.eclipse.swt.internal.gtk.version=3.14.12
It’s usually somewhere near line 84 ish. But you can copy the text and search for it in your text editor.
Note, if this line is missing altogether, you’re (very most likely) running Eclipse on Gtk2.
See what version is on your system
You can find out which version of gtk is installed on your system by running pkg-config (you might need to install it first). This gives you an indication of which version of gtk eclipse might be using.
pkg-config --modversion gtk+-3.0
Force Eclipse to use either gtk2 / gtk3
You can force Eclipse to use a certain version of gtk:
#Gtk3 forced: export SWT_GTK3=1 eclipse #Gtk2 forced: export SWT_GTK3=0 eclipse
Under gtk3, the entry in the about section should be present like: org.eclipse.swt.internal.gtk.version=3.14.12
[edit 2016-09Sep-08Thu]
This is actually by far the most visited blog entry on my blog (20k+ views)
I reference this page quite often, I made a short/memorable url for it: http://bit.ly/gtk2orgtk3
Do I have to install the GTK inspector on Ubuntu? Ctrl+Shift+I does nothing
LikeLike
Hello,
Not sure :-), on Fedora it comes pre-installed as far as I can tell, or it somehow made it onto my system anyhows.
I think it’s only available with gtk 3.14.
To find out your gtk version, type:
pkg-config –modversion gtk+-3.0
If it’s a key-binding problem, try typing this into terminal:
export GTK_DEBUG=interactive
Then run eclipse. The GtK-Inspector should pop up. If not, maybe you’re using gre 3.14? (how does eclipse look like, does it have + or > on the package explorer?)
I’ll update article in a minute.
LikeLike
I updated article.
LikeLike
The suggest way does not work for me on Ubuntu, I used:
dpkg -l libgtk2.0-0 libgtk-3-0
And got the output
ii libgtk-3-0:amd 3.10.8-0ubun amd64 GTK+ graphical user interface lib
ii libgtk2.0-0:am 2.24.23-0ubu amd64 GTK+ graphical user interface lib
LikeLike
which version of gtk are you using?
#:
pkg-config –modversion gtk+-3.0
LikeLike
pkg-config –modversion gtk+-3.0
results in no output
LikeLike
I see.
I did a bit more research. According to this article:
http://www.webupd8.org/2014/10/how-to-install-gnome-314-in-ubuntu.html
Ubuntu 14.10 (which I believe you are using?) ships with gtk 3.12. But gtkInspector was introduced in gtk3.14
I guess if you want to use gtkInspector, you’ll have to wait for another ubuntu upgrade or if you are brave, upgrade your gtk as described in the article above :-).
LikeLike
In cases where both GTK+2 or GTK+3 cause Eclipse to crash (Eclipse 4.2.2) … does this indicate that GTK package is corrupt(?) and needs to be reinstalled on Linux? Perhaps there is a safer alternative to using GTK+2 or GTK+3? Can you recommend same?
LikeLike
Well, somewhat unlikley. If you can run other applications but eclipse crashes, it probably means there is an issue with eclipse. It depends on many factors. Try using the eclipse that came with your linux distribution as oppose to downloading form the website, e.g the fedora-eclipse is pretty stable.
LikeLike
Another way to force Eclipse to use GTK 2 is to add the following two lines to the file eclipse.ini:
–launcher.GTK_version
2
The file eclipse.ini is in the same directory as the Eclipse executable, if you downloaded it from the eclipse.org site.
LikeLike
Correction: instead of the en dash — there should be two minus signs. WordPress unfortunately automatically replaces them with an en dash and I don’t know how to overcome it.
LikeLike
Thank you very much. This seems to be the standart way to define which GTK version to use. Plus, I got rid of the huge toolbar and tabs that my eclipse setup had (because of it using 3.x by default).
LikeLike
Hello there,
I am using Debian Jessie 8.3 with XFCE. In eclipse Mars I have black tooltip background and I think I tried everything. I tried to add export SWT_GTK3=0 in ~./profile as well as the solution Jaan suggested. In the end of the eclipse ini file I added:
–launcher.GTK–version
2
But that also didnt help at all. I am pretty desperate right now, I would apreciate all help really.
LikeLike
Try to download a newer version of eclipse, maybe even the beta builds:
http://download.eclipse.org/eclipse/downloads/
Eric did some work on the GdkColors some time ago:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477950
If that doesn’t help, I would recommend to try a different desktop interface if possible (e.g MATE), to see if that makes a difference. Maybe try a brighter background theme.
If all else fails, try Gnome3 with standard theme. Things work ok on that afaik. (it’s a bit memory heavy, I know 🙂 )
I’m in my last semester at university atm, not full-time at Eclipse. (will return in April). In the mean time, I would reccomend you post something to Eric Williams:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477950
He’s currently working on the GdkColor business that affects the tooltip. He’s probably looking for some testers =).
LikeLike
Thank you for your answer,
I have downloaded eclipse just last week so its pretty fresh, i think there were no updates since then.
As for the gui, I rather not change it. I find it really best of all so far :p.
I have found a solution that nearly fixed this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=439884
Now my tooltip is white, but hovered text aswell so ita unreadable. Im not sure what to do actually. As for the beta versions i rather not install any cutting edge software, but i would of course if thats to work this out.
LikeLike
You saved my life, I’m GTK+2 fan (almost slave :), and I need Eclipse to my job, I was stuck on this horrible problem and not anymore! Thank you!
LikeLike
Great! I was facing troubles with my Hi-Dpi laptop, and forcing GTK2 works fine! Thx++
LikeLike
Glad to hear.
There is a lot of active work going on right now to get HiDpi working well. For example icon scaling has been implemented. More recent nightly versions of Eclipse would work better with HiDpi.
As a note, there are plans on phasing out support for Gtk2 in 2-4 years and start migrating to Gtk4.
LikeLike
Ty for sharing this. Just my 2 cents:
If you wanna force gtk2 changing your eclipse.ini, you need to put “–launcher.GTK_version
2” BEFORE the “–launcher.appendVmargs”
http://stackoverflow.com/questions/24872995/why-does-my-eclipse-luna-4-4-crash-on-debian-wheezy-7-4-with-oracle-jdk8-64bit
Anyway, thanks.
LikeLike