java 启动tomcat时jre_home环境变量定义不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44322378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jre_home environment variable is not defined correctly while starting tomcat
提问by Durga
When I am trying to run tomcat using startup.bat
I get the following error,
当我尝试使用 tomcat 运行时startup.bat
,出现以下错误,
The JRE_HOME environment variable is not defined correctly
This environment variable is needed to run this program
I have even tried setting JRE_HOME manually to system variable list, but this issue remains.
我什至尝试将 JRE_HOME 手动设置为系统变量列表,但这个问题仍然存在。
My JRE_HOME C:\Program Files\Java\jre1.8.0_121;
我的 JRE_HOME C:\Program Files\Java\jre1.8.0_121;
What can I do to solve it?
我能做些什么来解决它?
I am using Windows 8
我使用的是 Windows 8
采纳答案by priya raj
Hope you know the way of setting path in Windows 8. //C:\Program Files\Java\jre1.8.0_121 surely as there is space between Program and Files, these kind of errors are possible. Please correct this path or store this in a path where no space is involved.In Path add JRE_HOME path and click ok Reopen Command prompt window, then again give startup.bat
希望你知道在Windows 8中设置路径的方法。 // C:\Program Files\Java\jre1.8.0_121 肯定是因为Program和Files之间有空格,所以这种错误是可能的。请更正此路径或将其存储在不涉及空间的路径中。在 Path 添加 JRE_HOME 路径并单击确定重新打开命令提示窗口,然后再次提供 startup.bat
Hope this helps
希望这可以帮助
回答by Rics
I was facing the same issue.
我面临同样的问题。
Firstly in your question it seems that the JRE_HOME
is having \bin
. This is not required.
Still you might get this error. So here is what I found to resolve this issue-
首先,在您的问题中,似乎JRE_HOME
有\bin
. 这不是必需的。您仍然可能会收到此错误。所以这是我发现解决这个问题的方法 -
In the running.txt
document that come with the Apache Tomcat says that it is better if the JRE_HOME
is defined in setenv.bat
file. This file does not exist on its own so you need to create it. The file has to be in %CATALINA_BASE%\bin\setenv.bat
path and the content should be
running.txt
Apache Tomcat 附带的文档中说如果JRE_HOME
在setenv.bat
文件中定义更好。此文件本身并不存在,因此您需要创建它。文件必须在%CATALINA_BASE%\bin\setenv.bat
路径中,内容应该是
set "JRE_HOME=C:\Java\jre8"
exit /b 0
JRE_HOME
should be the path where your JRE exist.
Now you can start the server.
JRE_HOME
应该是您的 JRE 存在的路径。现在您可以启动服务器了。