[wiki] Set all Java apps to use GTK+ font & theme settings

This is the feedback and discussion thread for the wiki page about giving Java apps the suiting GTK+ looks: https://wiki.manjaro.org/index.php?title=Set_all_Java_apps_to_use_GTK%2B_font_%26_theme_settings

6 Likes

you should not use /etc/profile but a *.sh file in /etc/profile.d

something like /etc/profile.d/90-java_ops.sh

Also it would be nice to change the code to

_JAVA_OPTIONS="[...] ${_JAVA_OPTIONS}"

this ${_JAVA_OPTIONS} lets the user make additional changes instead of just overwrite everything.

for example. with you current code the command:

_JAVA_OPTIONS="hehe=15" java -jar thisone.jar

would run java ONLY with the option hehe=15

Now if your command would add ${_JAVA_OPTIONS} this command would run java with the 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 hehe=15

5 Likes

Thanks, makes sense, adjusted! By the way, is there any possibility to make the code blocks allow several lines and thus prevent them from destroying the page layout?

Thanks for your useful information! It's great :smile:

1 Like

I have problem setting this on my system. I 've tried both ~/.profile and /etc/profile.d/ methods.
Now I run the export command from terminal and it gives me this error

bash: export: `-Dawt.useSystemAAFontSettings=on': not a valid identifier

I tried omitting the values one by one but still the same error.
What do I do wrong?
My specific setup may have something to do. I had to set Oracle java as default, for a specific java App (Memento Database) which runs fine but the theming is disturbing to me (too white!).

Maybe try to switch to OpenJDK temporarily to make sure that Oracle Java is the problem?

What needs to be changed to do this with OpenJDK?

Afaik this should work for both, Oracle and Open JDK, doesn't it?

It didn't work for JDownloader using OpenJDK 8. Wouldn't this need to be changed?

-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

It might be that this is a JDownloader specific problem since it seems to use some non-standard widgets for its interface...

Forum kindly sponsored by