@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 --------------------------------------------------------------------------- rem Make sure prerequisite environment variables are set rem In debug mode we need a real JDK (JAVA_HOME)
rem startup.bat启动的话,%1是start,往下执行
if ""%1"" == ""debug"" goto needJavaHome rem Otherwise either JRE or JDK are fine
rem JRE_HOME未设置,往下执行
if not "%JRE_HOME%" == "" goto gotJreHome
rem JAVA_HOME设置了跳到gotJavaHome
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
echo At least one of these environment variable is needed to run this program
goto exit :needJavaHome
rem Check if we have a usable JDK
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
set "JRE_HOME=%JAVA_HOME%"
goto okJava :noJavaHome
echo The JAVA_HOME environment variable is not defined correctly.
echo It is needed to run this program in debug mode.
echo NB: JAVA_HOME should point to a JDK not a JRE.
goto exit rem 设置JRE_HOME为java_home
:gotJavaHome
rem No JRE given, use JAVA_HOME as JRE_HOME
set "JRE_HOME=%JAVA_HOME%" rem 如果设置了jre_home环境变量就取jre_home下的java.exe和javaw.exe,否则取java_home下的
:gotJreHome
rem Check if we have a usable JRE
if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJreHome
goto okJava :noJreHome
rem Needed at least a JRE
echo The JRE_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto exit :okJava
rem Don't override the endorsed dir if the user has set it previously
rem 如果设置了环境变量JAVA_ENDORSED_DIRS就跳转,但是一般不设置,往下。Java9已经不支持该环境变量了。
if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir
rem Java 9 no longer supports the java.endorsed.dirs
rem system property. Only try to use it if
rem CATALINA_HOME/endorsed exists.
rem 不存在,所以跳转到gotEndorseddir
if not exist "%CATALINA_HOME%\endorsed" goto gotEndorseddir
set "JAVA_ENDORSED_DIRS=%CATALINA_HOME%\endorsed"
:gotEndorseddir rem Don't override _RUNJAVA if the user has set it previously
rem previously 事先
rem 如果设置了_RUNJAVA环境变量就跳转,但是一般不设置,往下走,将JRE_HOME\bin\java.exe设置为_RUNJAVA,这里的JRE_HOME是JAVA_HOME
if not "%_RUNJAVA%" == "" goto gotRunJava
rem Set standard command for invoking Java.
rem Also note the quoting as JRE_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java.exe"
:gotRunJava rem Don't override _RUNJDB if the user has set it previously
rem Also note the quoting as JAVA_HOME may contain spaces.
rem 如果_RUNJDB环境变量不为空就结束,实际不设置,所以将其设置为JAVA_HOME\bin\jdb.exe
if not "%_RUNJDB%" == "" goto gotRunJdb
set _RUNJDB="%JAVA_HOME%\bin\jdb.exe"
:gotRunJdb goto end :exit
exit /b 1 :end
exit /b 0 rem 整个脚本设置了JAVA_HOME,java.exe和jdb.exe目录

Tomcat启动脚本(3)setclasspath.bat的更多相关文章

  1. [Tomcat 源码分析系列] (二) : Tomcat 启动脚本-catalina.bat

    概述 Tomcat 的三个最重要的启动脚本: startup.bat catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 ca ...

  2. 100个Shell脚本——【脚本3】tomcat启动脚本

    [脚本3]tomcat启动脚本 一.脚本tomcatd.sh #!/bin/bash # chkconfig:2345 64 36 # description: Tomcat start/stop/r ...

  3. Tomcat启动脚本

    记录一个比较好的tomcat启动脚本,截取<OneinStack>,修改如下两个参数即可用. 使用之前修改下面2个参数: #Location of JAVA_HOME (bin files ...

  4. [Tomcat 源码分析系列] (一) : Tomcat 启动脚本-startup.bat

    概述 我们通常使用 Tomcat 中的 startup.bat 来启动 Tomcat. 但是这其中干了一些什么事呢? 大家都知道一个 Java 程序需要启动的话, 肯定需要 main 方法, 那么这个 ...

  5. Tomcat启动脚本(2)catalina.bat

    @echo off rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor lic ...

  6. linux中tomcat启动脚本:关闭、发布、重启、测试是否成功

    说明 在使用jenkins持续集成时,需要实现自动发布包到tomcat.该脚本实现了在jenkins将包发送到linux服务器上后的自动关闭.发布.启动.测试启动是否成功的过程 思路 该思路以tomc ...

  7. Tomcat启动脚本(1)startup.bat

    @echo off rem Licensed to the Apache Software Foundation (ASF) under one or more rem contributor lic ...

  8. Tomcat启动脚本catalina.sh

    1 - 概述脚本catalina.sh用于启动和关闭tomcat服务器,是最关键的脚本另外的脚本startup.sh和shutdown.sh都是使用不同的参数调用了该脚本该脚本的使用方法如下(引自该脚 ...

  9. tomcat 启动脚本走过的坑

    最近由于 程序写的问题 tomcat经常需要重启,所以就让我写给监控tomcat并启动的脚本 例: 看着一起正常 然后就写到 crontab 计划任务里了 后来发现不管用, 找了好多文档 就是找不到问 ...

随机推荐

  1. 【python】 编码转换

    #转码 def utf2gbk(string): #return string s=string.decode('utf-8','ignore').encode('gb18030','ignore') ...

  2. 初学Selenium遇上的问题

    1.IWebDriver driver = new InternetExplorerDriver();运行时报关于protecte model的错误 解决办法就是用如下代码设置IEDriverOpit ...

  3. 2019 SCUT SE 新生训练第四波 L - Boxes in a Line——双向链表

    先上一波题目 https://vjudge.net/contest/338760#problem/L 这道题我们维护一个双向链表 操作1 2 3 都是双向链表的基本操作 4操作考虑到手动将链表反转时间 ...

  4. RbMQ 简介

    Broker:简单来说就是消息队列服务器实体. Exchange:消息交换机,它指定消息按什么规则,路由到哪个队列. Queue:消息队列载体,每个消息都会被投入到一个或多个队列. Binding:绑 ...

  5. element UI的使用

    npm install --save element-ui main.js里面添加 import ElementUI from 'element-ui' import 'element-ui/lib/ ...

  6. for循环(C语言型)举例

  7. Vue的路有拦截与axios的封装

    一丶首先我们先创建api与utils两个文件夹 二丶api文件夹里面新建文件api.js import request from "../utils/http" import qs ...

  8. 常用yum源之(Percona MySQL)

    [percona]name = CentOS $releasever - Perconabaseurl=http://repo.percona.com/centos/$releasever/os/$b ...

  9. \ HTML5开发项目实战:照片墙

    html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...

  10. Concurrent - 多线程

    原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11426916.html Java中有几种方法可以实现一个线程? 继承Thread类(不支持多继承) 实 ...