Setting up Tomcat 7 on server: "NB: JAVA_HOME should point to a JDK not JRE"... Why?

30,365

Solution 1

Tomcat does not require a JDK. Tomcat ships with the Eclipse JDT compiler which Tomcat uses as part of the *.jsp -> *.java -> *.class process to convert JSPs to compiled Servlets.

However, if you specify JAVA_HOME, Tomcat expects that to point to a full JDK installation. If you want to use a JRE then you need to set JRE_HOME rather than JAVA_HOME.

Solution 2

remove semi-colon from the end of JRE_HOME / JAVA_HOME variables. there should not be semi-colon…

variable: JAVA_HOME value : C:\Program Files\Java\jdk1.6.0 (note : no semicolon at the end)

variable: JRE_HOME value : C:\Program Files\Java\jre1.6.0 (note : no semicolon at the end)

Apply above changes and run your tomcat successfully.

Solution 3

I had the same problem. Specified JRE_HOME and received the same error message. The error message persisted after I had removed the system environment variable JAVA_HOME and rebooted. Turned out my JRE path was actually incorrect, the error message was just confusing.

Share:
30,365
Paul
Author by

Paul

I'm still pretty junior. My dayjob is Enterprise web applications/services in big finance. Fun. Most of my questions are java/spring/oracleDB/javascript based. Some of my interests outside of work are natural computing and information filtering/recommendation.

Updated on July 09, 2022

Comments

  • Paul
    Paul almost 2 years

    I'm trying to set up Tomcat 6 on my server instance (Fresh install of Windows Server 2008 R2 Enterprise). I want to make a Java EE service available via a URL.

    It works via localhost on the server. I put the .war file in my /webapps, run startup.bat in the /bin and then i navigated to localhost:80/myWebServce in my browser to get directed to my welcome page.

    When I try to create a service by running service.bat (in the /bin folder)) I get an error message that says:

    The JAVA_HOME environment variable is not defined correctly
    This environment variable is needed to run this program
    NB: JAVA_HOME should point to a JDK not a JRE
    

    My question is: Why? I thought a JDK was just a JRE + Some development tools(an IDE, a debugger etc). Why does tomcat need a JDK To run as a service, but not on localhost? What's in a JDK that's needed to run a webservice?