tomcat the java home,Tomcat没有运行,即使JAVA_HOME路径是正确的

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 environment variable is needed to run this program

NB: JAVA_HOME should point to a JDK not a JRE

But then I try C:\>echo %java_home% and I get the following result

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

I have even tried setting JAVA_HOME manually to system variable list, but this issue remains.

What can I do to solve it?

I am using Windows 7.

Update

After setting a new system variable named JAVA_HOME and setting its path to "C:\Program Files\Java\jdk1.6.0_25\bin\", I tried the start up script again and this time I get a new error.

D:\Work\apache-tomcat-6.0.35\bin>startup.bat

Files\Java\jdk1.6.0_25"" was unexpected at this time.

Any idea what this error means?

I even tried setting the path to "C:\Program Files\Java\jdk1.6.0_25\"(that is without bin) but same error occurs.

解决方案

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值