8 Replies Latest reply: Feb 24, 2010 2:39 AM by PhHein RSS

    The JAVA_HOME environment variable is not defined correctly

    843833
      When I am starting Tomcat by startup.bat, it is giving me this error ...

      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


      AS, I have defined JAVA_HOME correctly,

      C:\Java\jdk1.5.0_13

      Please help me to solve this
        • 1. Re: The JAVA_HOME environment variable is not defined correctly
          843833
          hi,
          recheck weather your mention name is in uppercase or again your installed dir is correct

          or try like this

          name : CATALINA_HOME
          value : C:\Java\jdk1.5.0_13


          after execute the startup.bat under your tomcat\bin
          • 2. Re: The JAVA_HOME environment variable is not defined correctly
            843833
            If you think that your JAVA_HOME is defined correctly check if these files are available:

            %JAVA_HOME%\bin\java.exe
            %JAVA_HOME%\bin\javaw.exe

            Startup script is looking for these files and if they both exist error message should not be displayed.

            Maybe it is something wrong with your jdk instalation.

            CATALINA_HOME should points to your tomcat directory

            Reagrds,
            Sławomir Wojtasiak
            • 3. Re: The JAVA_HOME environment variable is not defined correctly
              843833
              Hi - I am starting to get this eror - although I have run Tomcat for a long time.
              However, I originally installed Tomcat on my XP 5.1 system using the Windows installer method - and everything worked fine. That is, fine, until I wanted to run webapps under NetBeans 6.0.1. The problem is that the run application would halt with an error because it could not find the shutdown.bat utility to restart the Tomcat to allow the service to be registered. So, I looked in the 5.5 zip file, and extracted the bat files, and put them in the %CATALINA_HOME%\bin directory, set JAVA_HOME and CATALINA_HOME, and got this error.
              I note that the windows Tomcat which uses the Services means to automatically start the service does not require any of these environment variables, and is happy to work away.
              I am going to undo my attempted reworking - and will wait to see if the new Tomcat 6 resolves the issue.
              The main problem appears to be - at least for me - an issue with the Netbeans not working happily with the windows version of Tomcat. I will check this out with Eclipse to see if I can get web applications coded more successfully there.
              If anyone has any work arounds I would be grateful to learn of them.
              rgds
              Mike
              • 4. Re: The JAVA_HOME environment variable is not defined correctly
                843833
                I have reinstalled my java.

                So I have just edited the catalina.bat under tomcat/bin folder.

                The Java_Home entry in that file is pointing to older version of my java.


                Thats it!!

                My question is can't it take dynamically from environment variable ??
                • 5. Re: The JAVA_HOME environment variable is not defined correctly
                  843833
                  Hi,
                  Modify the startup.bat file in tomcat's bin directory as follows:

                  set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_10
                  set CATALINA_HOME=C:\TOMCAT6
                  set JRE_HOME=C:\Program Files\Java\jre1.6.0

                  with your path.
                  Enjoy.
                  • 6. Re: The JAVA_HOME environment variable is not defined correctly
                    843833
                    The Environmental variable should be set as printed below.

                    Variable name: JAVA_HOME

                    Variable value : C:\Program Files.\Java\jdk1.6.0_07\


                    Many will be missing the backslash "\" after "jdk1.6.0_07" in the path.

                    I hope it solves your problem
                    • 7. Re: The JAVA_HOME environment variable is not defined correctly
                      843833
                      Also check ";" -sign in the end of the environment variable, it shouldn't be if it's the last or the only variable...
                      • 8. Re: The JAVA_HOME environment variable is not defined correctly
                        PhHein
                        Welcome to the forum. Please don't post in threads that are long dead and don't hijack other threads. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.

                        I'm locking this thread now.