在linux下对写好的java程序编写shell脚本要怎么写? 我写的代码如下,有错误
DFA.sh放在桌面DFA.java在/home/duanyt/workspace/DFA/srcDFA.in和DFA.class都在home/duanyt/worksp...
DFA.sh 放在桌面 DFA.java在/home/duanyt/workspace/DFA/src DFA.in和DFA.class都在home/duanyt/workspace/DFA/bin 。如图是我写的.sh文件和运行错误
展开
2个回答
展开全部
-----以下是我项目的startup.sh的内容------
-----用shell调用java程序----------
if [ -z ${JAVA_HOME} ]
then
echo "JAVA_HOME not set yet,can't run java program!"
exit -1
fi
CLASSPATH=.:${JAVA_HOME}/lib/tools.jar:${JAVA_HOME}/lib/dt.jar
JLIBDIR=./lib
export JLIBDIR
for LL in `ls ${JLIBDIR}/*.jar`
do
CLASSPATH=${CLASSPATH}:${LL}
done
echo ${CLASSPATH}
export CLASSPATH
JAVA_OPTION="-Dfile.encoding=GBK -Xms256m -Xmx256m -XX:MaxPermSize=64m"
RUN_CLASS=com.lxq.batch.Main
${JAVA_HOME}/bin/java ${JAVA_OPTION} -classpath ${CLASSPATH} ${RUN_CLASS}
-----用shell调用java程序----------
if [ -z ${JAVA_HOME} ]
then
echo "JAVA_HOME not set yet,can't run java program!"
exit -1
fi
CLASSPATH=.:${JAVA_HOME}/lib/tools.jar:${JAVA_HOME}/lib/dt.jar
JLIBDIR=./lib
export JLIBDIR
for LL in `ls ${JLIBDIR}/*.jar`
do
CLASSPATH=${CLASSPATH}:${LL}
done
echo ${CLASSPATH}
export CLASSPATH
JAVA_OPTION="-Dfile.encoding=GBK -Xms256m -Xmx256m -XX:MaxPermSize=64m"
RUN_CLASS=com.lxq.batch.Main
${JAVA_HOME}/bin/java ${JAVA_OPTION} -classpath ${CLASSPATH} ${RUN_CLASS}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询