1

Here is a stupid noob question. I installed Tomcat6 and java-6-oracle. I set the /env/environment to contain JAVA_HOME and JRE_HOME (and both point to the correct directory). However when I try and start tomcat6 it says:

no JDK found - please set JAVA_HOME

here is what my /etc/environment looks like:

JAVA_HOME="/usr/lib/jvm/java-6-oracle"
JRE_HOME="/usr/lib/jvm/java-6-oracle/jre"
FEDORA_HOME="/var/lib/fedora"
CATALINA_HOME="/var/lib/tomcat6"
JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=128m -Djavax.net.ssl.trustStore=/usr/local/fedora/server/truststore -Djavax.net.ssl.trustStorePassword=tomcat"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-oracle:/usr/lib/jvm/java-6-oracle/bin:/usr/lib/jvm/java-6-oracle/jre:/var/lib/fedora/server/bin:/var/lib/fedora/client/bin"

Where did I go wrong?

user5013
  • 233
  • 4
  • 8

4 Answers4

2

There is mainly the classpath issue in tomcat. There are many ways to solve it. One of the ways is as follows.

1) Locate the installed java. IT is present in /usr/lib/jvm/

2) After installing tomcat open its configuration

sudo vi /etc/default/tomcat7

3) Search for #JAVA_HOME Uncomment it and set the proper path Example JAVA_HOME=/usr/lib/jvm/java-7-oracle

4) Save the file and restart tomcat

ravi ranjan
  • 121
  • 3
1

By default Tomcat will run preferably with OpenJDK JVMs, then try the Sun JVMs, then try some other JVMs. You can force Tomcat to use a specific JVM by setting JAVA_HOME in /etc/default/tomcat6

nguyentran
  • 111
  • 1
0

It seems that when you start tomcat6, /etc/environment is not read.

In your tomcat6 start script, try to add this:

[ -r /etc/environment ] && . /etc/environment
pkhamre
  • 5,900
  • 3
  • 15
  • 27
0

Add these lines to $CATALINA_HOME/bin/setenv.sh (or catalina.sh, but setenv.sh is included by it):

export JAVA_HOME="/usr/lib/jvm/java-6-oracle"
export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=128m Djavax.net.ssl.trustStore=/usr/local/fedora/server/truststore Djavax.net.ssl.trustStorePassword=tomcat"

export makes the variable available to child processes.

Jason Floyd
  • 1,672
  • 1
  • 13
  • 17