title: my tomcat uses wrong JAVA_HOME or JRE_HOME
body: <p>I'm new to Tomcat. their is something wrong about Tomcat 7 on my ubuntu 10.10.</p>
  
  <p>when I start Tomcat like this</p>
  
  <pre><code>llchli@llchli-virtual-machine:/usr/local/apache-tomcat-7.0.47/bin$ ./catalina.sh  run
  Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.47
  Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.47
  Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.47/temp
  Using JRE_HOME:        /usr/local/jdk1.7.0_45
  Using CLASSPATH:       /usr/local/apache-tomcat-7.0.47/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.47/bin/tomcat-juli.jar
  </code></pre>
  
  <p>although cannot start Tomcat this way, it echos <code>Using JRE_Home  /usr/local/jdk1.7.0_45</code>, which is the correct <code>JAVA_HOME</code> or <code>JRE_HOME</code> on my computer.</p>
  
  <p>but when I start Tomcat with <code>sudo</code> like this</p>
  
  <pre><code>llchli@llchli-virtual-machine:/usr/local/apache-tomcat-7.0.47/bin$ sudo ./catalina.sh  start
  [sudo] password for llchli: 
  Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.47
  Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.47
  Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.47/temp
  Using JRE_HOME:        /usr
  Using CLASSPATH:       /usr/local/apache-tomcat-7.0.47/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.47/bin/tomcat-juli.jar
  </code></pre>
  
  <p>it echos <code>Using JRE_HOME:        /usr</code>,which is not the correct <code>JAVA_HOME</code> or <code>JRE_HOME</code> on my computer. But it start Tomcat correctly.</p>
  
  <p>my <code>/etc/environment</code> is </p>
  
  <pre><code>llchli@llchli-virtual-machine:/usr/local/apache-tomcat-7.0.47/bin$ sudo cat /etc/environment 
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/jdk1.7.0_45/bin"
  LANGUAGE="en"
  JAVA_HOME="/usr/local/jdk1.7.0_45"
  CLASSPATH="$CLASSPATH:$JAVA_HOME/lib"
  CATALINA_HOME="/usr/local/apache-tomcat-7.0.47"
  </code></pre>
  
  <p>I'm a bit puzzled about this.And when I use <code>daemon.sh</code> like this, it generate errors.</p>
  
  <pre><code>llchli@llchli-virtual-machine:/usr/local/apache-tomcat-7.0.47/bin$ sudo ./daemon.sh run
  Cannot find any VM in Java Home /usr
  Cannot find any VM in Java Home /usr
  Cannot locate JVM library file
  Service exit with a return value of 1
  </code></pre>
  
  <p>It echos <code>cannot find any VM in Java Home /usr</code>. I'm so confused.</p>
  
  <p>Any helps and advise will appreciate.</p>
  
  <p>Thanks in advance.</p>