在Tomcat的发行包中有一个bat文件很有意思.
可以把指定的参数添加到classpath里面.
和bat脚本for一起配合,可以实现自动的把某个目录下的jar包都放到classpath里.
配合for一起用
可以把指定的参数添加到classpath里面.
和bat脚本for一起配合,可以实现自动的把某个目录下的jar包都放到classpath里.
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->
rem
---------------------------------------------------------------------------
rem Append to CLASSPATH
rem
rem $Id: cpappend.bat 301115 2002 - 08 - 04 18 : 19 :43Z patrickl $
rem ---------------------------------------------------------------------------
rem Process the first argument
if "" % 1 "" == """" goto end
set CLASSPATH =% CLASSPATH % ; % 1
shift
rem Process the remaining arguments
:setArgs
if "" % 1 "" == """" goto doneSetArgs
set CLASSPATH =% CLASSPATH % % 1
shift
goto setArgs
:doneSetArgs
:end
rem Append to CLASSPATH
rem
rem $Id: cpappend.bat 301115 2002 - 08 - 04 18 : 19 :43Z patrickl $
rem ---------------------------------------------------------------------------
rem Process the first argument
if "" % 1 "" == """" goto end
set CLASSPATH =% CLASSPATH % ; % 1
shift
rem Process the remaining arguments
:setArgs
if "" % 1 "" == """" goto doneSetArgs
set CLASSPATH =% CLASSPATH % % 1
shift
goto setArgs
:doneSetArgs
:end
配合for一起用
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->
set CURRENT_DIR
=%
cd
%
set CLASSPATH = .
for %% i in ( % CURRENT_DIR % \lib\ * .jar) do call cpappend.bat %% i
start java - Duser.dir =% CURRENT_DIR % - cp % CLASSPATH % a.b.c.MainApp
set CLASSPATH = .
for %% i in ( % CURRENT_DIR % \lib\ * .jar) do call cpappend.bat %% i
start java - Duser.dir =% CURRENT_DIR % - cp % CLASSPATH % a.b.c.MainApp
本文介绍了一个Tomcat发行包中的bat文件,该文件能够将指定目录下的所有jar包自动添加到Classpath中,方便进行Java应用部署。
5373

被折叠的 条评论
为什么被折叠?



