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?

  • You also can set JAVA_HOME explicitly in catalina.sh – user1516873 Mar 22 '13 at 9:07
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.

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

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

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
  • I put that in the startup.sh script but it didn't work. Any other ideas? – user5013 Mar 22 '13 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.