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


3 Answers 3


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/swing.properties

gksu gedit /usr/lib/jvm/java-6-sun/jre/lib/swing.properties

  • 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:

  • 1
    didn't fix it, but still very useful for me :) thanks!
    – RolandiXor
    Jan 16, 2011 at 21:50
  • 2
    Thanks. I used this as a tip but instead did; UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); which does not require any configuration file editing. Sep 15, 2013 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. :(
    – jobukkit
    Nov 19, 2013 at 15:01
  • 1
    It hepled me to solve "jdk bold font" bug. Thank you.
    – MInner
    Jun 26, 2014 at 16:23
  • Didn't fix for universalmediaserver on Ubuntu Mate 14. May 9, 2017 at 11:37

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

  1. export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'

  2. Then launch in this terminal your app.

  3. If you are satisfied with your result - add this line to your ~/.profile file.
  • 1
    Putting this into ~/.profile didn't work for me, but I put _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" into /etc/environment (note the usage of double rather than single quotes and the missing export, otherwise the magic doesn't work).
    – Photon
    Mar 9, 2017 at 13:03
  • Works fine with SweetHome3D and Ubuntu 18.04 Feb 17, 2019 at 7:29
  • Thanks a lot for the help. If anyone is experiencing Swing application crash like mine, consider removing the last option Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
    – Puspam
    Mar 12, 2022 at 10:46

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 ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(info.getClassName())) {   

This might be also helpful.

  • @Jop Are you sure about other platforms? What about KDE themes? Nov 19, 2013 at 9:05
  • 1
    Nevermind, I was wrong, sorry. But why not just javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");?
    – jobukkit
    Nov 22, 2013 at 17:47
  • 2
    @Jop Since Java applications are platform independent you should check if GTK theme is installed in your system. Nov 23, 2013 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .