Sunday, 1 May 2011

Ubuntu 11.04 set a new environment variable (persistently)

Custom environment variables are stored in /etc/environment file.

sudo gedit /etc/environment

If you open this file you will see the PATH variable's value. If you would like to set a new one just move to new line and set your variable in {variable_name}="{variable_value}" format. Such as JAVA_HOME="/usr/lib/jvm/java-6-sun/bin"

DONT FORGET TO OPEN FILE AS SUPER USER and restart your computer after you saved the changes.

To see the list of environment variables:
bash$ export


Joaquin said...

Thanks, it helped me a lot

Dmitriy said...

Many thanks for this manual!

Anonymous said...

thanks a lot it's really great...
i googling for this for one day