linux上jar包的运行

指定目录:

#!/bin/bash
source /etc/profile
log()
{
echo `date +【%Y-%m-%d" "%H:%M:%S】` $1
}
log "start 168 begain"
nohup /home/data/168/program/jdk1.8.0_111/bin/java -Drun.type=loaddata -ms512m -mx1024m -jar /home/data/168/program/importFile168.jar >> /home/data/168/program/168.log 2>&1 &
log "start 168 end"

 加载第三方jar包

配置:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export JAVA_HOME=/home/ismp/jdk1.7
export PATH=$JAVA_HOME/bin:$PATH 
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH

 shell脚本:

#!/bin/bash
source /etc/profile
lib_path="/home/ismp/write_charge/lib"
for jar in `ls $lib_path/*.jar`
do
CLASSPATH=$CLASSPATH":"$jar
echo $CLASSPATH
done
/home/ismp/jdk1.7/bin/java -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -classpath $CLASSPATH main.App $bill_cycle 6

  

 

 

转载于:https://www.cnblogs.com/JAYIT/p/9579511.html

你可能感兴趣的:(linux上jar包的运行)