问题描述
当我尝试使用 startup.bat 运行 tomcat 时,出现以下错误,
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
然后我尝试 C:>echo %java_home% 并得到以下结果
But then I try C:>echo %java_home% and I get the following result
C:Program FilesJavajdk1.6.0_25in
我什至尝试将 JAVA_HOME 手动设置为系统变量列表,但这个问题仍然存在.
I have even tried setting JAVA_HOME manually to system variable list, but this issue remains.
我能做些什么来解决它?
What can I do to solve it?
我使用的是 Windows 7.
I am using Windows 7.
在设置一个名为 JAVA_HOME 的新系统变量并将其路径设置为 "C:Program FilesJavajdk1.6.0_25in" 后,我再次尝试了启动脚本,这当我得到一个新的错误时.
After setting a new system variable named JAVA_HOME and setting its path to "C:Program FilesJavajdk1.6.0_25in", I tried the start up script again and this time I get a new error.
D:Workapache-tomcat-6.0.35in>startup.bat
FilesJavajdk1.6.0_25"" was unexpected at this time.
知道这个错误是什么意思吗?
Any idea what this error means?
我什至尝试将路径设置为 "C:Program FilesJavajdk1.6.0_25"(即没有 bin),但出现同样的错误.
I even tried setting the path to "C:Program FilesJavajdk1.6.0_25"(that is without bin) but same error occurs.
推荐答案
尝试在其他地方安装 java - 在没有空格的目录中.再次设置 JAVA_HOME 变量并重试.我记得 Tomcat 在 Window XP 上遇到了一些带有空格的问题,如果它在启动时使用的任何变量包含空格.也许它与 Windows 7 类似.
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.
我记得我不得不更改处理 Tomcat 启动的 Tomcat java 类中的一些行.
I remember I had to change some lines in Tomcat java classes which were handling Tomcat startup.
@Edit: Luciano 让我注意到它,但你也应该从 JAVA_HOME
@ Luciano beat me to noticing it but you should also remove bin from JAVA_HOME
@Edit: 我还记得另一个修复(虽然没有自己测试过)是将 JAVA_HOME 设置为简写版本,例如C:Progra~1Javajdk1.6.0_25
@ 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~1Javajdk1.6.0_25
这篇关于即使 JAVA_HOME 路径正确,Tomcat 也没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)