Ubuntu – How to set JAVA environment variables system wide

environment-variables

I work as java/j2ee application developer so kindly tell me how to set JAVA_HOME, JRE_HOME, CLASSPATH so that I may use Tomcat, Mysql ,java all together in Terminal.

I may be using all together in a pure CLI server environment, or in a GUI desktop environment.

Best Answer

  • Using 12.04, placing the information in /etc/environment worked for me:

    tku@buster:~$ cat /etc/environment 
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    [...]
    LC_MEASUREMENT="de_DE.UTF-8"
    JAVA_HOME=/home/tku/work/jdk1.7.0_05
    
  • Related Question