title: Make $JAVA_HOME easily changable in Ubuntu
body: <p>In Ubuntu, I'd like to switch my JAVA_HOME environment variable back and forth between Java 5 and 6.</p>
  
  <p>I open a terminal and type in the following to set the JAVA_HOME environment variable:</p>
  
  <pre><code>export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
  </code></pre>
  
  <p>And in that same terminal window, I type the following to check that the environment variable has been updated:</p>
  
  <pre><code>echo $JAVA_HOME
  </code></pre>
  
  <p>And I see <strong>/usr/lib/jvm/java-1.5.0-sun</strong> which is what I'm expecting to see.  In addition, I modify ~/.profile and set the JAVA_HOME environment variable to /usr/lib/jvm/java-1.5.0-sun.</p>
  
  <p>And now for the problem--when I open a new terminal window and I check my JAVA_HOME environment variable by typing in <strong>echo $JAVA_HOME</strong> I see that my JAVA_HOME environment variable has been reverted back to Java 6.  When I reboot my machine (or log out and back in, I suppose) the JAVA_HOME environment variable is set to Java 5 (presumably because of the modification I made in my ~/.profile).</p>
  
  <p>Is there a way around this so that I can change my JAVA_HOME environment without having to log out and back in (AND make that environment variable change <em>stick</em> in all new terminal windows)?</p>