Java XAMPP Tomcat/启动 Tomcat 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20145226/
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
XAMPP Tomcat/Error starting Tomcat
提问by J1234
Can someone help me solve this:
有人可以帮我解决这个问题:
"Tomcat Started/Stopped with errors, return code: 1 Make sure you have Java JDK or JRE installed and the required ports are free. Check the "/xampp/tomcat/logs" folder for more information."
“Tomcat 启动/停止时出现错误,返回代码:1 确保您已安装 Java JDK 或 JRE 并且所需端口可用。查看“/xampp/tomcat/logs”文件夹以获取更多信息。”
I have installed Java JDK. Thanks
我已经安装了 Java JDK。谢谢
回答by Magic-Mouse
Is your java registered in the enviorement variables.
您的java是否已在环境变量中注册。
If you open console Win+R -> CMD and write java --version (For JDK) and java -version (for JRE) do you get any output ?
如果您打开控制台 Win+R -> CMD 并编写 java --version(对于 JDK)和 java -version(对于 JRE),您会得到任何输出吗?
回答by Alex
WINDOWS-KEY + PAUSE
(shortcut to System Properties), in system properties choose
Advanced system settings --> Environment variables --> add a new System variable:
WINDOWS-KEY + PAUSE
(系统属性的快捷方式),在系统属性中选择
高级系统设置--> 环境变量--> 添加新的系统变量:
Fill in:
填写:
Variable name: JAVA_HOME
Variable value: C:\Program Files\Java\jdk1.8.0
(or whatever your location/version is)
变量名称:JAVA_HOME
变量值:(C:\Program Files\Java\jdk1.8.0
或任何您的位置/版本)
klik ok and done(maybe you should restart tomcat after this)
单击确定并完成(也许您应该在此之后重新启动 tomcat)
回答by ioses
Try to change your port. Maybe you have another app running in the port 8080.
尝试更改您的端口。也许您有另一个应用程序在端口 8080 中运行。
If you run in the 8081 for example it will run correctly
例如,如果您在 8081 中运行,它将正确运行
回答by Anonymous
Run XAMPP with "Administrator Privileges" to start Tomcat. It is as simple as that.
使用“管理员权限”运行 XAMPP 以启动 Tomcat。它是如此简单。
回答by Vikash Kumar
Go to https://youtu.be/JmmaeS7UZRkyoutube link for better understanding:
转到https://youtu.be/JmmaeS7UZRkyoutube 链接以更好地理解:
we need to create an Environment Variable "JAVA_HOME". and give the vale as JDK installation directory path. Ex: "C:\Program Files\Java\jdk1.8.0_66"
we need to create an Environment Variable "JRE_HOME". and give the vale as JRE installation directory path. Ex: "C:\Program Files\Java\jre1.8.0_66"
- Go to your "tomcat" installation directory and then "conf" folder. Ex: "C:\xampp\tomcat\conf".
- Edit these given files with these values:
i) open server.xmlfile which is located inside conffolder. Go to line number "70" and change the "port" number "8080" as something else for example "9999" and save it.
ii) open context.xmlfile which is located inside "conf" folder and go to line number "19" and change
<Context>
tag as<Context reloadable="true">
and save it. - close the "XAMPP" App and restart it.
- Now go to the "Config" Option inside "XAMPP" application i.e top right corner of the XAMPP app. then go to the "Service and Port Settings" then go to the "Tomcat" tab and put "9999" as the "HTTP Port" value and save it. Not restart XAMPP.
- Now try to start "Tomcat" Server.
- Open your browser and type localhost:9999 in the browser url and hit enter.
我们需要创建一个环境变量“JAVA_HOME”。并给出 vale 作为 JDK 安装目录路径。例如:“C:\Program Files\Java\jdk1.8.0_66”
我们需要创建一个环境变量“JRE_HOME”。并给出 vale 作为 JRE 安装目录路径。例如:“C:\Program Files\Java\jre1.8.0_66”
- 转到您的“tomcat”安装目录,然后转到“conf”文件夹。例如:“C:\xampp\tomcat\conf”。
- 使用以下值编辑这些给定的文件:i) 打开位于conf文件夹内的server.xml文件。转到行号“70”并将“端口”号“8080”更改为其他内容,例如“9999”并保存。ii) 打开位于“conf”文件夹内的context.xml文件并转到行号“19”并更改标记为并保存。
<Context>
<Context reloadable="true">
- 关闭“XAMPP”应用程序并重新启动它。
- 现在转到“XAMPP”应用程序中的“配置”选项,即 XAMPP 应用程序的右上角。然后转到“服务和端口设置”,然后转到“Tomcat”选项卡,将“9999”作为“HTTP 端口”值并保存。不重启 XAMPP。
- 现在尝试启动“Tomcat”服务器。
- 打开浏览器并在浏览器 url 中输入 localhost:9999 并按回车键。