java classpath批量設置shell腳本
linux bash jar文件之間的分隔符是':'
www.2cto.com
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%