Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to get java apps to use my gtk theme?

share|improve this question
Similar question for KDE/Qt:… – Mechanical snail Nov 5 '12 at 5:01
Related:… – Mechanical snail Nov 5 '12 at 5:22
up vote 19 down vote accepted

You can try to set Java's default look and feel to GTK:

Open a terminal ( Ctrl + Alt + T ) and paste the upper one for openjdk and the lower one for sun java .

gksu gedit /usr/lib/jvm/java-6-openjdk/jre/lib/

gksu gedit /usr/lib/jvm/java-6-sun/jre/lib/

  • Follow the comment in that file and remove the hash sign, so it looks like:

    # uncomment to set the default look and feel to GTK
  • Save and restart the java app.

Before and after:

share|improve this answer
didn't fix it, but still very useful for me :) thanks! – RolandiXor Jan 16 '11 at 21:50
Thanks. I used this as a tip but instead did; UIManager.setLookAndFeel(""); which does not require any configuration file editing. – xconspirisist Sep 15 '13 at 18:56
@RolandiXor If this didn't work, that means the developer of the app hardcoded the look and feel. Nothing you can do about that, unless it is open-source. :( – Jop V. Nov 19 '13 at 15:01
It hepled me to solve "jdk bold font" bug. Thank you. – MInner Jun 26 '14 at 16:23

If you are the developer or it's an open source, an alternative way is to change the look and feel of the application. Insert the below code in the main method.

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("".equals(info.getClassName())) {   

This might be also helpful.

share|improve this answer
@Jop Are you sure about other platforms? What about KDE themes? – giannis christofakis Nov 19 '13 at 9:05
Nevermind, I was wrong, sorry. But why not just javax.swing.UIManager.setLookAndFeel("‌​l");? – Jop V. Nov 22 '13 at 17:47
@Jop Since Java applications are platform independent you should check if GTK theme is installed in your system. – giannis christofakis Nov 23 '13 at 17:47

If you have tryed solutions above - try using this (helped me on Xfce):

  1. export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
  2. Then launch in this terminal your app
  3. If you are satisfied with your result - add this line to your ~/.profile file
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.