Havin_it Veteran
Joined: 17 Jul 2005 Posts: 1247 Location: Edinburgh, UK
|
Posted: Sun Jun 21, 2015 2:46 pm Post subject: User environment variables: where to set for broadest scope? |
|
|
Hi,
Something I thought would be quite straightforward is proving not to be: I need to add an envvar to the execution environment for NetBeans (and potentially any future apps that use Swing), no matter in which way it is launched.
Here's the payload: Code: |
# For font antialiasing in Swing apps like NetBeans
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=lcd' |
NetBeans is launched via a /bin/sh script, <netbeans-appdir>/bin/netbeans. That script might be executed in any of the following ways:- Locally, from my DE's menu (currently fluxbox; /usr/bin/startfluxbox is a /bin/sh script launched in ~/.xsession)
- From a terminal (urxvtd, SHELL=/bin/bash)
- Either of the above, but within a VNC session
- Remotely, using X11 forwarding (ssh -X or -Y)
Places I have tried exporting the variable:- ~/.bashrc
- ~/.bash_profile (above or below where .bashrc is sourced)
- ~/.profile
- ~/.xsession
None of these work in all of the above contexts, and most don't work in any of them apart from in a terminal
Isn't there a place where envvars can be set "globally" per-user, so they apply for anything that user runs? I'm sure I remember being able to do so before (for Firefox, Qt and maybe others), but that was a while back and possibly it just worked where I needed it to at the time, I dunno.
Caveats/unacceptable answers:- /etc/env.d/ is out, because I don't want all users to have this variable set.
- Adding the export into the netbeans script itself would certainly work, but is inelegant and would be clobbered at every upgrade of the software.
- Creating an outer wrapper script that runs netbeans with the var prefixed would also work, but not for those hypothetical other Swing apps (I'd need a wrapper per app), so that's out too.
C'mon Internet, impress me |
|