When I am trying to run tomcat using startup.bat
I get the following error,
The JAVA_HOME environment variable is not defined correctly
This env
First Run the tomcat directly through the tomcat /bin folder with
startup.bat if running sucessful the set the variable as below sample
JAVA_HOME value : C:\Program Files\Java\jdk1.6.0_32;
path: C:\Program Files\Java\jdk1.6.0_32\bin;
CATALINA_HOME=C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27 ;
PATH=%PATH%;%JAVA_HOME%\bin;%CATALINA_HOME%\bin;
if needed CLASS_PATH:%CATALINA_HOME%\lib;%JAVA_HOME%\lib;
I deleted the Tomcat and unzipped it again and it worked.
Check the comparability, if you are using java 8 then use tomcat 9, if you are using java 7 then use tomcat 7. and also set the JAVA_HOME till C:\Program Files\Java\jdk1.8.0_101, not with bin.
Remove semicolon and you can see that link: http://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html
To run Tomcat8 you need to have JRE_HOME defined in Env Variable.
JAVA_HOME alone will not do even if correctly set.
JRE_HOME = C:\Program Files\Java\jdk1.8.0_77\jre
You should select the JRE that is inside SDK, i.e. one with your JDK(SDK) installation. In other words your JAVA_HOME + \jre
When compiling JDK is needed to support JSP, to compile Servlets which are generated from *.jsp files. Otherwise to run JRE is needed. So when you develop you need JAVA_HOME and when you deploy you need JRE_HOME.
Also ensure that you have the correct version of Tomcat for the CPU type. I had installed a 64bit tomcat on a 32bit O/S but it was giving me the JAVA_HOME exception when that wasn't the case at all.