Tomcat is not running even though JAVA_HOME path is correct

前端 未结 18 2140
情深已故
情深已故 2020-12-09 16:07

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

The JAVA_HOME environment variable is not defined correctly
This env         


        
相关标签:
18条回答
  • 2020-12-09 16:42

    Some times semiColon makes matter please ensure

    JAVA_HOME=c:\Program Files\Java\jdk1.6.0_32 
    

    but not

    JAVA_HOME=c:\Program Files\Java\jdk1.6.0_32;
    

    Same problem i got but not solved

    0 讨论(0)
  • 2020-12-09 16:44

    Remove the 'bin' from JAVA_HOME. That solves the issue.

    0 讨论(0)
  • 2020-12-09 16:44

    there are two types of environment variable first User variable if you path in this it will work for that particular user only. second is System variable if you set path in this it is used by all type of users.. In my system i set JAVA_HOME in system variable,it was not working,then i set path in User variable it is working.....so try in both type of environment variable...

    0 讨论(0)
  • 2020-12-09 16:45

    Try installing java somewhere else - in a directory without spaces. Set again the JAVA_HOME variable and try again. I remember Tomcat had some problems on Window XP with spaces if any variables it was using while starting contained spaces. Maybe it's similar with Windows 7.

    I remember I had to change some lines in Tomcat java classes which were handling Tomcat startup.

    @Edit: Luciano beat me to noticing it but you should also remove bin from JAVA_HOME

    @Edit: I also remember that another fix (didn't test it myself, though) was to set JAVA_HOME to the shorthand version e.g. C:\Progra~1\Java\jdk1.6.0_25

    0 讨论(0)
  • 2020-12-09 16:47

    For reference for me with Atlassian's Bamboo the issue was because I had wrapped the command in speech marks

    So

    SET JRE_HOME="C:\Program Files\Java\jre1.8.0_121"
    

    Was wrong, where as the right version is

    SET JRE_HOME=C:\Program Files\Java\jre1.8.0_121
    

    This gave me the error message

    Files\Java\jre1.8.0_121"" was unexpected at this time.
    
    0 讨论(0)
  • 2020-12-09 16:48

    I think that your JAVA_HOME should point to

    C:\Program Files\Java\jdk1.6.0_25
    

    instead of

    C:\Program Files\Java\jdk1.6.0_25\bin
    

    That is, without the bin folder.

    UPDATE

    That new error appears to me if I set the JAVA_HOME with the quotes, like you did. Are you using quotation marks? If so, remove them.

    0 讨论(0)
提交回复
热议问题