解决java执行时需要设置lib库文件,节约部署时间。
Linux环境下:
Windows环境下:
run.bat
setenv.bat
Linux环境下:
#!/bin/sh
binPath='/gsp/services/cyworld_userinfo/bin/'
libPath='/gsp/services/cyworld_userinfo/lib/';
cd $binPath
folderPath=`find ../lib/ -name *.jar |cut -d '/' -f3-10 2>>/dev/null`
cp="$binPath";
for libFile in $folderPath
do
cp="$cp:$libPath$libFile"
done
#echo $cp;
nohup java -server -classpath $cp cn.com.cyworld.userinfo.UIService &
echo $! > ./pid
binPath='/gsp/services/cyworld_userinfo/bin/'
libPath='/gsp/services/cyworld_userinfo/lib/';
cd $binPath
folderPath=`find ../lib/ -name *.jar |cut -d '/' -f3-10 2>>/dev/null`
cp="$binPath";
for libFile in $folderPath
do
cp="$cp:$libPath$libFile"
done
#echo $cp;
nohup java -server -classpath $cp cn.com.cyworld.userinfo.UIService &
echo $! > ./pid
Windows环境下:
run.bat
@echo off
set cp=
for %%i in (".\lib\*.jar") do call setenv.bat %%i
SET %cp%;
java -classpath %cp% cn.cy2.emailservices.EmailService
set cp=
for %%i in (".\lib\*.jar") do call setenv.bat %%i
SET %cp%;
java -classpath %cp% cn.cy2.emailservices.EmailService
setenv.bat
set cp=%cp%;%1