Skip to content

Instantly share code, notes, and snippets.

@arky
Created February 18, 2025 11:53
Show Gist options
  • Save arky/2f90993ea67a544f8801f7482e125c12 to your computer and use it in GitHub Desktop.
Save arky/2f90993ea67a544f8801f7482e125c12 to your computer and use it in GitHub Desktop.
Improving Java GUI Rendering on Ubuntu
Running certain Java applications on GNU/Linux can be unreliable. Java applications often use their own mechanisms for GUI and font rendering, which might not work well under the GNU/Linux operating system.
On Ubuntu 20.04 LTS, I found that the behavior of most Java applications can be controlled by supplying predefined variables to the Java runtime in `/etc/profile.d/jre.sh`.
``` bash
# /etc/profile.d/jre.sh
export JDK_JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
export JDK_JAVA_OPTIONS='-Djdk.gtk.version={2,2.2,3}'
export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'
```
Please refer to the following document for a more detailed explanation: [https://wiki.archlinux.org/title/Java#Tips_and_tricks](https://wiki.archlinux.org/title/Java#Tips_and_tricks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment