Search code examples
javatomcatubuntu-18.04java-home

Although I have JAVA_Home set, the system can not find it


I set my JAVA_HOME variable the follow path: /usr/lib/jvm/jdk11 and when i put the following comand: java -version , it shows me the current version and echo $JAVA_HOME indicates the above path. When I start tomcat the following error message comes up: neither JAVA_HOME nor JRE_HOME variable defined.

I setting up everything right, but the tomcat cant find it.


Solution

  • Tomcat calls a script, setenv.sh, from catalina.sh.

    Create a script called setenv.sh in the directory CATALINA_BASE/bin, and add the line: "export JAVA_HOME=/usr/lib/jvm/jdk11". Make the script executable, i.e. chmod +x setenv.sh