Getting Error:JRE_HOME variable is not defined correctly when trying to run startup.bat of Apache-Tomcat

155,755

Solution 1

Got the solution and it's working fine. Set the environment variables as:

  • CATALINA_HOME=C:\Program Files\Java\apache-tomcat-7.0.59\apache-tomcat-7.0.59 (path where your Apache Tomcat is)
  • JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25; (path where your JDK is)
  • JRE_Home=C:\Program Files\Java\jre1.8.0_25; (path where your JRE is)
  • CLASSPATH=%JAVA_HOME%\bin;%JRE_HOME%\bin;%CATALINA_HOME%\lib

Solution 2

Your JRE_HOME does not need to point to the "bin" directory. Just set it to C:\Program Files\Java\jre1.8.0_25

Share:
155,755

Related videos on Youtube

Rajeev Dixit
Author by

Rajeev Dixit

I am a technology enthusiast, truly believes in doing, contributing, sharing to disrupt the ways for a better solution of every problem.

Updated on July 09, 2022

Comments

  • Rajeev Dixit
    Rajeev Dixit almost 2 years

    When trying to start Tomcat Server through cmd prompt using 'startup.bat' getting error as-"JRE_HOME variable is not defined correctly. The environment variable is needed to Run this program" Defined Environment path as-

    CATALINA_HOME-C:\Program Files\Java\apache-tomcat-7.0.59\apache-tomcat-7.0.59
    JAVA_HOME-C:\Program Files\Java\jdk1.8.0_25;
    JRE_Home-C:\Program Files\Java\jre1.8.0_25\bin;

    • Faiz Ahmed
      Faiz Ahmed over 5 years
      I solved my problem by the following link. stackoverflow.com/questions/44322378/…
    • user3806999
      user3806999 over 3 years
      This happens when you have different versions of JDK and JRE versions.Please consider that too when u finding solution for this problem.Thanks
  • Rajeev Dixit
    Rajeev Dixit about 9 years
    I tried but its not working.Still the same error persist.
  • Sorin Postelnicu
    Sorin Postelnicu almost 8 years
    I suppose you meant to put the "...\bin" folders inside the PATH, not inside the CLASSPATH
  • Rajeev Dixit
    Rajeev Dixit almost 8 years
    All I meant to say was to declare the path in system variables and by default the variable name globally is Path.
  • Sagar
    Sagar over 7 years
    Perfect answer...
  • Amir Choubani
    Amir Choubani over 6 years
    this solution works with me for apache tomcat 9
  • Bharti Rawat
    Bharti Rawat over 6 years
    In my case same problem in occurring.. I just simply removed semicolon from JRE_HOME and put like this C:\Program Files\Java\jre1.8.0_25 then this problem resolved successfully.
  • Nibras
    Nibras about 6 years
    Worked for me for Tomcat 9
  • Sanket Gupte
    Sanket Gupte over 5 years
    This solution is not working for me while trying with Tomcat 7. Have set the paths alright, yet getting the error as JRE_HOME environment variable not defined correctly. Have tried removing semicolon as well. Not working
  • Omak Al-Qantara
    Omak Al-Qantara about 3 years
    Tomcat looks for JRE_HOME first and if it is not found then looks for JAVA_HOME so you don´t need both, also you don´t need the CLASSPATH variable, just include JAVA_HOME at path variable (%JAVA_HOME%\bin;) and that´s it, important: open a new console to start your tomcat this refreshes the changes.