title: How to fix "The JAVA_HOME environment variable is not defined" in Ubuntu Server
body: <p>I'm trying to set up a java web app, and I keep getting the error <code>The JAVA_HOME environment variable is not defined</code>. Here is what I'm trying to do:</p>
  
  <p><code>user: /dir... $ /opt/pivotal/pivotal-tc-server-standard-3.1.3.SR1/tcruntime-instance.sh create myserver</code></p>
  
  <p>Then I get this error:</p>
  
  <p><code>The JAVA_HOME environment variable is not defined</code></p>
  
  <p>What I've tried to do:</p>
  
  <p>~Set the environment variable in <code>/etc/environment</code>. I opened <code>/etc/environment</code> with sudo nano, and added the following, <code>JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"</code>.</p>
  
  <p>~Set the environment variable in <code>/etc/profile</code>. I opened <code>/etc/profile</code> with sudo nano, and added the following, <code>export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"</code>, then <code>export PATH=$JAVA_HOME/bin:$PATH</code>.</p>
  
  <p>Neither of these solutions worked. This seems like an easy fix, but I must be overlooking something. Any suggestions?</p>