Tomcat is not running even though JAVA_HOME path is correct(即使 JAVA_HOME 路径正确,Tomcat 也没有运行)
问题描述
当我尝试使用 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 也没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:即使 JAVA_HOME 路径正确,Tomcat 也没有运行
基础教程推荐
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 降序排序:Java Map 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01