启动java程序的批处理

windows 下的批处理文件:

@echo off
rem 当前盘符和路径:%~dp0

set root_path=%~dp0
set lib_path=%root_path%libs

rem jar存放路径 %lib_path%

cd %lib_path%
setlocal enabledelayedexpansion 
for /R %%d in (*) do (
set cp=!cp!;%%d
)
rem classpath %cp%

cd %root_path%bin
java -cp %cp% cn.eticket.dailybatch.Main
 

linux下的批处理文件:

#!/bin/sh
app_home=`pwd`
classpath=$app_home/bin

for libjar in "$app_home"/libs/*.jar
do
classpath="$classpath":"$libjar"
done

echo $classpath
cd "$app_home"/bin
nohup java -cp $classpath cn.demo.Main $* > myout.file 2>&1 &

 

目录结构:

project/bin project/libs project/*.*

 

网络上另外一个例子的参考地址:

http://blog.csdn.net/jadyer/article/details/7960802

 

 

 

 

 

你可能感兴趣的:(java)