Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between JAVA_HOME and JRE_HOME

I have a script that starts Tomcat and it looks like this:

rem set JRE_HOME=C:\Program Files\Java\jdk1.7.0_03 set JRE_HOME=C:\Program Files\Java\jre7\ set CATALINA_HOME=D:\test\Server\apache-tomcat-6.0.18 "%CATALINA_HOME%\bin\catalina.bat" jpda start 

I can set JRE_HOME to either my jre folder or my JDK folder and Tomcat will work, but if I remove JRE_HOME and use JAVA_HOME instead, Tomcat will only work if I give it the path to the JDK folder.

So what is the difference between JRE and JAVA home, why does Tomcat behave in this manner?

like image 551
Goozo Avatar asked Jun 20 '12 13:06

Goozo


People also ask

What is the difference between JAVA_HOME and JRE_HOME?

The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME variable is used to specify location of a JDK. Using JAVA_HOME provides access to certain additional startup options that are not allowed when JRE_HOME is used. If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.

What is difference between JAVA_HOME and path?

PATH values: notice how the directory we set for JAVA_HOME is the JDK installation root whereas for PATH we add the bin directory within the JDK installation. Take care to set these up correctly otherwise you'll have problems later on.

Is JAVA_HOME needed?

Any Java-written program will require a Java-based environment in which to run. Programs that require the JAVA_HOME variable to be configured properly include: Eclipse, NetBeans and Android Studio. Apache Tomcat and WebSphere Portal.

How do I know if my house is JRE?

Click the Advanced tab, and then click Environment Variables. Under System Variables, look for the JAVA_HOME system variable. The JAVA_HOME path should point to the location that you recorded when you installed the JRE.


1 Answers

Tomcat enables some additional debugging options at start up if you are running with a full JDK. These options require the JDK so you Tomcat checks you are actually using one if you claim that you are to ensure these options don't fail if used.

I rarely see these options being used. I think I have used them once in getting on for 10 years working with Tomcat.

When you use JRE_HOME Tomcat doesn't enable JDK specific options so it doesn't check if you are running with the full JDK rather than the JRE.

like image 104
Mark Thomas Avatar answered Sep 29 '22 09:09

Mark Thomas