Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jre_home environment variable is not defined correctly while starting tomcat

Tags:

java

tomcat

When I am trying to run tomcat using startup.bat I get the following error,

The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program

I have even tried setting JRE_HOME manually to system variable list, but this issue remains.

My JRE_HOME C:\Program Files\Java\jre1.8.0_121;

What can I do to solve it?

I am using Windows 8

like image 456
Durga Avatar asked Jan 21 '26 11:01

Durga


2 Answers

I was facing the same issue.

Firstly in your question it seems that the JRE_HOME is having \bin. This is not required. Still you might get this error. So here is what I found to resolve this issue-

In the running.txt document that come with the Apache Tomcat says that it is better if the JRE_HOME is defined in setenv.bat file. This file does not exist on its own so you need to create it. The file has to be in %CATALINA_BASE%\bin\setenv.bat path and the content should be

set "JRE_HOME=C:\Java\jre8"
exit /b 0

JRE_HOME should be the path where your JRE exist. Now you can start the server.

like image 92
Rics Avatar answered Jan 24 '26 02:01

Rics


Hope you know the way of setting path in Windows 8. //C:\Program Files\Java\jre1.8.0_121 surely as there is space between Program and Files, these kind of errors are possible. Please correct this path or store this in a path where no space is involved. In Path add JRE_HOME path and click ok Reopen Command prompt window, then again give startup.bat

Hope this helps

like image 36
priya raj Avatar answered Jan 24 '26 03:01

priya raj