`
supportopensource
  • 浏览: 515521 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

tomcat setclasspath.bat解读(含setenv.bat)

 
阅读更多
setclasspath.bat注释版:
rem setclasspath.bat用于确定JAVA_HOME和JRE_HOME环境变量的设置
@echo off
echo Enter the setclasspath.bat file ......
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 $Id: setclasspath.bat 1202062 2011-11-15 06:50:02Z mturk $
rem ---------------------------------------------------------------------------

rem Make sure prerequisite environment variables are set     rem 确保设置必备的环境变量

rem In debug mode we need a real JDK (JAVA_HOME)             rem debug模式下需要设置JAVA_HOME环境变量 
if ""%1"" == ""debug"" goto needJavaHome                     rem 如果参数是debug即debug模式,就直接跳到needJavaHome

rem Otherwise either JRE or JDK are fine                     rem 否则直接查看是否JDK或JRE设置
rem set JAVA_HOME=%CATALINA_HOME%\..\jdk                     rem 可以在这里设置JAVA_HOME,也可以在setenv.bat中设置

if not "%JRE_HOME%" == "" goto gotJreHome                    rem 如果设置了JRE_HOME环境变量,就直接跳到gotJreHome
if not "%JAVA_HOME%" == "" goto gotJavaHome                  rem 如果设置了JAVA_HOME环境变量,就直接跳到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 debug
rem Check if we have a usable JDK                            rem 检查是否我们有可用的JDK
if "%JAVA_HOME%" == "" goto noJavaHome                       rem 如果JAVA_HOME没有设置,就直接跳到noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome      rem 如果设置了JAVA_HOME且在JAVA_HOME\bin\java.exe不存在,就直接跳到noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome     rem 如果javaw.exe不存在,就直接跳到noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome       rem 如果jdb.exe不存在,就直接跳到noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome     rem 如果javac.exe不存在,就直接跳到noJavaHome
set "JRE_HOME=%JAVA_HOME%"                                   rem 如果都存在,则设置JRE_HOME为JAVA_HOME
goto okJava                                                  rem 直接跳到okJava

:noJavaHome
rem debug
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 跳到gotJavaHome表示设置了JAVA_HOME但没有设置JRE_HOME
rem No JRE given, use JAVA_HOME as JRE_HOME
set "JRE_HOME=%JAVA_HOME%"                                    rem 如果设置了JAVA_HOME但是没有设置JRE_HOME,则设置JAVA_HOME为JRE_HOME

:gotJreHome
rem Check if we have a usable JRE
if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome         rem 如果不存在java.exe,则直接跳到noJreHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJreHome
goto okJava                                                   rem 如果均都不存在,就直接跳到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 Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java"
set _RUNJDB="%JAVA_HOME%\bin\jdb"

goto end

:exit
exit /b 1

:end
exit /b 0



setclasspath.bat使用版:
@echo off
echo Enter the setclasspath.bat file ......
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 $Id: setclasspath.bat 1202062 2011-11-15 06:50:02Z mturk $
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
rem set JAVA_HOME=%CATALINA_HOME%\..\jdk

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 Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java"
set _RUNJDB="%JAVA_HOME%\bin\jdb"

goto end

:exit
exit /b 1

:end
exit /b 0



setenv.bat文件(自定义环境变量文件):
rem Do not set the variables in this script(catalina_note.bat). Instead put them into a script setenv.bat in CATALINA_BASE/bin to keep your customizations separate.
echo Enter the setenv.bat file ......
set JAVA_HOME=%CATALINA_HOME%\..\jdk



分享到:
评论

相关推荐

    解析Tomcat的启动脚本–catalina.bat

    至于 setclasspath.bat 这个脚本, 相信看完这一篇, 就可以自己看懂这个脚本了. 可以点击下载 [ setclasspath.bat 脚本 ]查看附注释的 setclasspath.bat 脚本 catalina.bat 这个脚本的代码有点多, 就单独弄了一篇...

    用BAT设置WINDOWS系统环境变量,如java的jdk环境变量

    classpath.bat classpath2.bat classpath2.bat java_home.bat java_home.bat,把当前路径设置为系统环境变量等。

    Tomcat 6.0

    tomcat6.0归档分发,bin里包含有catalina.bat和setclasspath.bat脚本文件

    apache-tomcat-9.0.34.zip

    Tomcat资源,下载后需设置新增环境变量CATALINA_HOME,值为安装的路径(之前需安装JDK,配置好JAVA_HOME,CLASSPATH,用户变量Path),然后就可以使用了

    IKVM.GNU.Classpath

    用于处理PDF,或将PDF转换为jpg图片格式时用到的dll

    apache-tomcat-6.0.14.zip

    安装Tomcat后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的tomcat安装在c:\tomcat):    CATALINA_HOME=c:\tomcat  CATALINA_BASE=c:\tomcat    然后修改环境变量中的...

    tomcat6.0配置.mht

    第一步:下载jdk和tomcat:JDK下载 Tomcat下载 最新的jdk为1.6.10,tomcat为6.0,建议jdk1.4以上,tomcat4.0以上 第二步:安装和配置你的jdk和tomcat:执行jdk和tomcat的安装程序,然后设置按照路径进行安装即可。 ...

    Tomcat Using CLASSPATH:报错和启动成功无法访问情况解决方案

    Using CLASSPATH: /www/apache-tomcat-10.0.0-M3-src/bin/bootstrap.jar:/www/apache-tomcat-10.0.0-M3-src/bin/tomcat-juli.jar touch: cannot touch ‘/www/apache-tomcat-10.0.0-M3-src/logs/catalina.out’: No ...

    tomcat启动的问题--apr

    信息: Find registry server-registry.xml at classpath resource 2010-8-11 18:24:13 org.apache.catalina.startup.Catalina start 信息: Server startup in 1235 ms 查了一下,需要一个apr支持,然后按提示去 下载...

    dubbo管理工具

    dubbo管理工具dubbo-admin,jdk1.6 修改bin下的setclasspath.bat文件指定jdk版本启动

    linux tomcat9+jdk8.rar

    linux系统,tomcat9 + jdk8压缩包,...注意修改tomcat 的 catalina.sh和setclasspath.sh文件,首行加入jdk路径即可。 export JAVA_HOME=/你的路径/jdk/jdk1.8.0_181 export JRE_HOME=/你的路径/jdk/jdk1.8.0_181/jre

    jdk1.7.0_45-x64

    jdk1.7.0_45 32位版本,64位环境也可以使用,免安装版,直接下载解压即可,通过setclasspath.bat引入

    Apache-tomcat-6.0.53 for Linux(Redhat/CentOS测试通过)

    提供tomcat6 for linux,给急需使用的朋友应急,官网上不好找了。Redhat6.6下测试通过。安装说明: 1.解压并且解包 输入命令:tar -zxvf apache-tomcat-6.0.53.tar.gz 在目录下有apache-tomcat-6.0.53文件夹,重命名...

    scorm 2004 安装说明

    详细的scorm2004安装步骤 运行SCORM.2004.4ED.SRTE.v1.1.1.exe 安装完之后 找到Scorm安装路径: ADL\SCORM_2004_4th_Ed_Sample_RTE_V1.1.1\Sample_RTE\apache-tomcat\bin 下setclasspath.bat文件打开编辑 如下图:

    Tomcat6.0版本

    需要在startup.bat里配jdk路径,右键编辑后 添加 set JAVA_HOME=%jdk路径% set classpath=.;%class路径%\lib;%tomcat路径%\common\lib;%tomcat路径%\common\lib\servlet-api.jar; set path=%jdk路径%\bin;%...

    com.sysdeo.eclipse.tomcat_3.2.1

    Eclipse里的tomcat插件 This plugin does not contain Tomcat. ...The plugin sets itself Tomcat classpath and bootclasspath. Use Preferences -> Tomcat ->JVM Settings, only if you need specific settings.

    .classpath

    .classpath

    springboot+mybatis+内置tomcat示例.rar

    内容1:spingboot打包成 jar包 内置 tomcat 直接可以运行,out\artifacts 点 startup.bat ,maven,直接下载动态库 jdk1.8 64位。 内置 log4j2 日志文件,每天生成日志 application.properties 配置如下 #静态...

    设置环境变量BAT文件

    右键编辑,在上面第3行有javahome地址,把他改为你自己的Java安装目录就可以. ...classPath 在追加PATH,存在最前面. 本人试过..但也会有不足,望各位说留言批评. http://blog.csdn.net/lpy3654321/article/details/9822439

    设置JDK环境变量脚本.bat

    双击dos脚本,一键完成jdk环境变更设置。详细使用看脚本中的注释说明。设置java_home classpath 添加到系统path

Global site tag (gtag.js) - Google Analytics