I have horrible, improperly-rendered fonts in Java programs such as jabref and rubymine. This can be fixed by running

_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on' jabref

I understand that I could export these Java options as environment variables, and launch the programs from the command line. However, is there a way to set these options globally, so that all Java programs recognise them, no matter how they are launched?

I'm also know that I could modify all the *.desktop files for my Java programs, but I'm looking for a global solution.

I am using java-7-openjdk on Arch Linux. (FWIW this used to be okay with the now-broken jre7-openjdk-headless-infinality installed.)

  • For me it only works if i launch the app from terminal, if i use the application launcher from the xfce panel or if i use a script from the desktop it doesn't get any parameter. Why?? – user84102 Sep 14 '14 at 0:27
  • @MARCOFranciosi I don't know. It works fine for me. You'll have to comment on the answer so that they answerer can respond, although I'm not sure if you have enough rep yet. – Sparhawk Sep 14 '14 at 0:39

You know how to set the variable in a shell, but for the record you can write:

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'

and all programs you start from this shell session after that will have the variable set.

If you want it to be set for every shell you start afterwards, add that line to ~/.profile as well. In that case it will apply to all future shells you start, but not any that are currently running.

.profile will generally work for the GUI as well, but that can be broken by system configuration and how you start things up. This is per-user configuration only.

If you want it set for every user all the time, you can add an assignment to /etc/environment. The format is a little different there: just KEY=VAL on separate lines, with no required quoting and none of anything else.


This is parsed by the pam_env module. There is a per-user ~/.pam_environment file as well, which has the same effect for just the one user. These both require logging out and back in for the change to take effect. The variables will be set for every future login session, both at the console and in X.

Similarly, you can make a file in /etc/profile.d with an export statement in it and it will be loaded into every future session by any user. There will likely be some pre-existing files there to model it on, but just the export line above will be fine.

Alternatively, you can add the export statement in ~/.xinitrc (if you use startx), ~/.xsession, or ~/.xprofile. KDE also supports a directory ~/.kde/env that can contain as many shell files as you want, which contain export statements as above. I would probably prefer one of the other approaches.

  • 1
    Great answer. Clear and thorough. FWIW I used the /etc/environment option, which seemed most logical to me. – Sparhawk Aug 23 '14 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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