/etc/environment file in Ubuntu

Submitted by Jochus on Tue, 26/01/2010 - 19:45 | Posted in: Linux

Environment variables provide a way to influence the behavior of software on the system. For example, the "LANG" environment variable determines the language in which software programs communicate with the user.

The meaning of an environment variable and the format of its value are determined by the application using it. There are quite a few well-known environment variables for which the meaning and the format have been agreed upon and they are used by many applications.

After installing Java, I needed to set the JAVA_HOME var, which was pointing to my JVM installation (/usr/lib/jvm/java-6-sun). Normally, I always set these vars in ~/.bashrc. But a lot of applications didn't seem to pick up this variable. I most of the time received errors as "JAVA_HOME NOT SET".

After Googling a while, I came to the conclusion that you have to set these vars in /etc/environment. In this way, all applications seem to pick up the JAVA_HOME variable :-)

Add new comment

The content of this field is kept private and will not be shown publicly.


  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.