分析 Tomcat setclasspath.bat 脚本 迷南。 2021-06-24 15:56 308阅读 0赞 在 catalina.bat 中 调用 , rem Get standard Java environment variables if exist "%CATALINA\_HOME%\\bin\\setclasspath.bat" goto okSetclasspath echo Cannot find "%CATALINA\_HOME%\\bin\\setclasspath.bat" echo This file is needed to run this program goto end :okSetclasspath call "%CATALINA\_HOME%\\bin\\setclasspath.bat" %1 if errorlevel 1 goto end 设置 tomcat 启动前 需要获取的环境变量 @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) if ""%1"" == ""debug"" goto needJavaHome rem Otherwise either JRE or JDK are fine if not "%JRE\_HOME%" == "" goto gotJreHome 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 :gotJavaHome rem No JRE given, use JAVA\_HOME as JRE\_HOME set "JRE\_HOME=%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 if not "%JAVA\_ENDORSED\_DIRS%" == "" goto gotEndorseddir rem Set the default -Djava.endorsed.dirs argument set "JAVA\_ENDORSED\_DIRS=%CATALINA\_HOME%\\endorsed" :gotEndorseddir rem Don't override \_RUNJAVA if the user has set it previously 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. if not "%\_RUNJDB%" == "" goto gotRunJdb set \_RUNJDB="%JAVA\_HOME%\\bin\\jdb.exe" :gotRunJdb goto end :exit exit /b 1 :end exit /b 0
还没有评论,来说两句吧...