java classpath 批量设置shell脚本

linux bash jar文件之间的分隔符是':'

export JAR_HOME=path to directory which includes jars

for f in $JAR_HOME/*.jar
do
JAR_CLASSPATH=$JAR_CLASSPATH:$f
done
export JAR_CLASSPATH

#the next line will print the JAR_CLASSPATH to the shell.
echo the classpath $JAR_CLASSPATH
java -classpath $JAR_CLASSPATH Name of the programme

windows jar文件之间的分隔符是';'


SETLOCAL ENABLEDELAYEDEXPANSION
set LIB=xx
set CLASSPATH=.
FOR %%C IN (%LIB%\*.jar) DO set CLASSPATH=!CLASSPATH!;%%C
echo %CLASSPATH%

猜你喜欢

转载自alantong08.iteye.com/blog/1759245