tomcat 部署笔记

一、修改tomcat启动窗口的名称

场景:我们在启动tomcat的时候,一般会出现tomcat窗口,默认窗口名字是tomcat,如果我们想知道这个tomcat的端口号,我们需要查看配置文件,很麻烦有木有。如果我们可以直接把端口号设置在窗口上,直接打开就知道这个tomcat的端口号。岂不是很爽。只需要简单设置一下就ok

打开tomcat所在的目录bin/catalina.bat 这个文件夹

找到if "%TITLE%" == "" set TITLE=Tomcat 大概在 335行

if "%TITLE%" == "" set TITLE=Tomcat

修改 

if "%TITLE%" == "" set TITLE=Tomcat-8888

二、启动Tomcat一闪而过

一般是操作系统的java环境变量没有设置好

方法一 设置操作系统的java环境变量 后,就可以解决

​ 1、新建JAVA_HOME:C:Program FilesJavajdk1.8.0_161(jdk目录路径)

​ 2、找到Path,没有的话新建Path:%JAVA_HOME%in;%PATH%

注意:如果是Windows10系统,要写jdk和jre的绝对路径

Path:C:Program FilesJavajre1.8.0_161in;C:Program FilesJavajdk1.8.0_161in

3、新建CLASSPATH:.;%JAVA_HOME%lib;%JAVA_HOME%lib ools.jar

方法二 如果不行,用下面的方法

bin/starup.bat 文件最后面 pause 命令,可以阻塞当前窗口,方便调试。窗口不关闭,可以查看错误信息

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

:end
pause

调试好后 在 pause 删除

有时候 系统环境变量不能设置生效,可以在 tomcat里面 设置 java环境变量

一、 Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat,只要在setclasspath.bat的开头声明环境变量(红色两行)就可以了,原因是后来较新版本安装完不会自动登记环境变量JAVA_HOME,JRE_HOME。

C:Program FilesJavajdk1.8.0_172 这个系统安装的java地址

set JAVA_HOME=C:Program FilesJavajdk1.8.0_172
set JRE_HOME=C:Program FilesJavajre1.8.0_172

大约加在22行下面

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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 ---------------------------------------------------------------------------
set JAVA_HOME=C:Program FilesJavajdk1.8.0_172
set JRE_HOME=C:Program FilesJavajre1.8.0_172
rem Make sure prerequisite environment variables are set
原文地址:https://www.cnblogs.com/z_lb/p/12833704.html