Loading... ## 关于tomcat不能启动一闪而过90%情况的解决方 > 说明:出现这种情况最大的原因就是环境变量中JAVA_HOME的配置有问题,不是有错就是没有配置;还有一种情况就是tomcat的锅,他没有找到你配置的JAVA_HOME,最简单的解决方法就是下面所说的: --- * 需要在tomcat的bin文件下找到 'setclasspath.bat' 文件,之后用记事本打开,找到这段代码 ```dos rem See the License for the specific language governing permissions and rem limitations under the License. rem --------------------------------------------------------------------------- rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings rem are valid and consistent with the selected start-up options and set up the rem endorsed directory. rem --------------------------------------------------------------------------- ``` * 在这段代码之后添加 ```dos rem set user jdk and jre home set JAVA_HOME=D:\jdk1.8_171 set JRE_HOME=D:\jre1.8 ``` * 其中**JAVA_HOME ** 和 **JRE_HOME** 是你安装Java时候所安装的路径,**路径** 后面包括 **=** 后面 都不能有空格,否则还是会一闪而过。配置好的代码如下: ```dos rem --------------------------------------------------------------------------- rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings rem are valid and consistent with the selected start-up options and set up the rem endorsed directory. rem --------------------------------------------------------------------------- rem set user jdk and jre home set JAVA_HOME=D:\jdk1.8_171 set JRE_HOME=D:\jre1.8 rem Make sure prerequisite environment variables are set rem In debug mode we need a real JDK (JAVA_HOME) if ""%1"" == ""debug"" goto needJavaHome ``` 然后再重新启动 tomcat 应该就可以正常启动了 。 如果这个方法不行的话可以在 **startup.bat** 文件的最后加上 **pause** ,就可以让一闪而过窗口不关,显示在桌面上,然后查看不能启动的其他原因~ --- ps:个人总结 最后修改:2020 年 08 月 28 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 哇卡哇卡