JRE_HOME variable missing with Tomcat (win7)
Asked Answered
O

9

11

I installed tomcat and Apache http-servers like two weeks ago. I got it running and I was able to run the JSP-pages from another computers. I had a little pause and now that I'm trying to run the system it doesn't work. I can access the default index-page in the

  http://[my-IP-address]:8080 

but cannot access the jsp folder's pages, not even .html files. It gives me

  503 service temporarily unavailable. 

Not even the localhost seems to work.I can't recall if the Tomcat server needs to be started or if the mod_jk.so automatically handles that. When I try to start the tomcat with startup.bat it gives me the message

 JRE_HOME environment variable is not defined correctly

I've set the environment variables from system properties and I could compile/run .java files without problems.

 JAVA_HOME C:\Program Files (x86)\Java\jdk1.6.0_16

 JRE_HOME C:\Program Files (x86)\Java\jre6

So what's going on here? I installed Visual Studio, but otherwise I cannot think of any reason why the tomcat doesn't work all of the sudden. This is very frustrating, so any help would be much appreciated.

Offen answered 19/9, 2012 at 10:28 Comment(7)
Which version in Tomcat you are using ? Are you using any IDE's? From my understanding when we set both jdk and jre the tomcat used to take the JRE's path first.Noyade
I'm using Tomcat 7.0.27 and no IDE's, just a basic text editor.Offen
I hope can you try without the jre home variable and use java_home for jdk , if you are using any service you can opt for jre let me know the output what happens when you are using jdk alone?Noyade
I cleared all the Java related environment variables, installed JRE7, and linked just that to JRE_HOME. Running java programs on command line works fine but the Tomcat still complains about the ill defined variable.Offen
After some testing I found that http://[my-IP-address]:8080/test/jsp/index.html does work but http://[my-IP-address]:8080/test2/jsp/index.html doesn't, even thought they have the exactly the same content and permissions. HTML works, but I still can't run the JSP.Offen
From my understanding deployment should be the prob ,Have you deployed the test2?if its deployed, there will not be any prob in accessing.Are you facing the same 503 error still?Noyade
I must admit that I'm bit lost with the JSP-ideology. I'm not using any .java files. I just have a simple form in the index file. The POST action refers to a .jsp file that just prints the form data. This worked fine two weeks ago, but now it seems that my tomcat has a bad day and doesn't want to cooperate with me. I can access the from, but when I click the submit-button I get lots of loading that ends into 503. My guess is that the tomcat is not recognized properly.Offen
N
25

Configure paths like this

enter image description here

You can check the validity of the path by typing

echo %JAVA_HOME%

echo %JRE_HOME%

enter image description here

and then everything will work like a charm

Nolde answered 29/4, 2014 at 8:5 Comment(1)
very and helpful helpfulFloury
A
5

There is no need to set both the JDK_HOME and JRE_HOME environment variables since JRE_HOME will default to the value of JDK_HOME.

In many Tomcat installations these environment variables are not used at all, being instead set in the optional setenv.bat script. You can find all this documented in section 3 of the RUNNING.txt file in the top level directory of your Tomcat installation and a copy can be found here http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt

If you get the "environment variable is not defined correctly" error message you will need to check your setenv.bat file (if you have one) as well as the actual environment variables. By inspection of setclasspath.bat you can see which files it needs to see in those directories. For the JRE it expects to find both %JRE_HOME%\bin\java.exe and %JRE_HOME%\bin\javaw.exe

In my experience this error occurs when the JRE or JDK has been subsequently removed or uninstalled.

Abscise answered 20/2, 2015 at 1:52 Comment(0)
I
3

If you have not installed the SDK, then provide the JRE path and logout and in - this should work

Inurn answered 24/6, 2013 at 18:44 Comment(0)
G
2

I recently ran into this issue, and regardless of how many times I checked.. the variable was set in the windows advanced system properties.

What I found was that if the JRE_HOME var wasn't set, the system would default to the JRE that was part of the JDK in the JAVA_HOME directory. If you're running into this problem, and cannot resolve it.. try deleting the JRE_HOME variable.

That resolved the issue for me.

Gallia answered 16/4, 2015 at 12:25 Comment(0)
A
2

I face with the same problem and I solve it by changing tomcat configuration in Intellij from its default to my own jre folder like the image below : enter image description here

Azoic answered 20/7, 2016 at 4:38 Comment(0)
O
1

So, I installed Apache Tomcat/7.0.30 and now the startup runs perfectly. No more 503 error and I can run the JSP stuff from other machines as I should be.

Problem is solved, but the mystery remains. It seems that jdk had nothing to do with the problem. Did my tomcat die of old age or something?

Offen answered 21/9, 2012 at 9:4 Comment(3)
Did you reinstall your tomcat ??Noyade
I upgraded it from 7.0.27 to 7.0.30 and now my setup works as it should be.Offen
Had the exact same problem with version 7.0.23 of tomcat. Updating to 7.0.52 solve the issue. Thanks.Mofette
B
0

windows 7. tomcat 8 I was having the same problem. I was getting the ire_environment error. I applied HimalayanCoder's solution. To my surprise, the echo failed to see the java_home or the ire_home. I checked both paths and settings in enviro and both were correct. I rebooted my machine 5 times, and the echo for the java_home worked, but the ire_home still was not showing. tomcat is still not working and I am still getting jre_home error. I kept rebooting machine and after an addition 5 reboots, the jre_home path came through. my tomcat now works.

thanks HimalayanCoder.

Bosworth answered 6/2, 2015 at 18:5 Comment(0)
S
0

Path has some other version of java like JDK1.6. Please remove the unwanted version in the path, then start the Tomacat 7.

After trying all the possible answers I have checked my path and then I have removed the Java1.6 from the path, then started the tomcat. It worked for me.

Sparse answered 26/9, 2016 at 14:34 Comment(0)
S
0

I just resolved this issue by deleting the JRE_HOME variable.As it was saying "JRE_HOME variable is not set to this path (Apache\bin)."

Suburbia answered 18/10, 2016 at 2:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.