I have installed JAVA using this guide https://community.linuxmint.com/tutorial/view/1372 It works, but I don't know how to set JAVA_HOME variable for all my users.

How to set global environment varialbes in Linux Mint ?

I'm using LinuxMint 18 Sara xfce

  • also asked in linuxmint forums, wating for help: forums.linuxmint.com/… At the moment I solved for some users defining JAVA_HOME in .bash_aliases but i desire a global solution. Thanks in advance – MadMad666 Jan 26 '17 at 15:51

How do I set global environment variables in Linux Mint?

Set them in /etc/profile.

When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists.

After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

Source 6.2 Bash Startup Files

| improve this answer | |
  • That doesn't answer the question. – Lelanthran Sep 26 '19 at 18:21
  • @Lelanthran Really? Care to explain why you think it doesn't? – DavidPostill Sep 26 '19 at 20:01
  • That sets the environment only for the shell, specifically for sh-compatible shells. When OP launches his program from the menu or the panel or the desktop launcher it wont' get any of the variables set in /etc/profile. OP specifically asked for setting an environment veriable GLOBALLY i.e. it must be set even when not running a terminal, or a shell, etc. – Lelanthran Sep 27 '19 at 21:17

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.