log4j.appender.logServicefile=org.apache.log4j.DailyRollingFileAppender log4j.appender.logServicefile.File=logs/TestMysql log4j.appender.logServicefile.DatePattern=yyyy-MM-dd-HH'.log' log4j.appender.logServicefile.Append=true log4j.appender.logServicefile.layout=org.apache.log4j.PatternLayout log4j.appender.logServicefile.layout.ConversionPattern=[%5p] [data-migrate] %d{yyyy-MM-dd HH:mm:ss}: %-4r [%t] ( %F,%L ) - %m%n
@echo off set DIRNAME=.\ if "%OS%" == "Windows_NT" set DIRNAME=%~dp0% if "%OS%" == "Windows_NT" set PROGNAME=%~nx0% set "JAVA_HOME=D:\tools\Java\jdk1.6.0_22" set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar setlocal enabledelayedexpansion set "JAVA=%JAVA_HOME%\bin\java" set OPTS=-Xms512M -Xmx1024M -XX:+AggressiveOpts -XX:+UseParallelGC -XX:NewSize=64M set LIBPATH=.\lib set CP=%DIRNAME%; rem set MAIN=com.arcsoft.nosql.data.task.mixture.ClientFileOfCloudQuery set MAIN=com.defonds.mysql.TestMysql rem set MAIN= com.arcsoft.nosql.data.test.MigrateMain for /f %%i in ('dir/b %LIBPATH%\*.jar^|sort') do (set CP=!CP!%LIBPATH%\%%i;) echo =============================================================================== echo. echo Engine Startup Environment echo. echo JAVA: %JAVA% echo. echo JAVA_OPTS: %OPTS% echo. echo CLASSPATH: %CP% echo. echo =============================================================================== echo. java %OPTS% -classpath %CP% %MAIN% rem java %OPTS% -classpath %CP% %MAIN% arg1 arg2 rem pause rem exit
#!/bin/sh PATH="$PATH:$JAVA_HOME/bin" export PATH CLASSPATH=. for k in lib/*.jar do CLASSPATH=$CLASSPATH:$k done export CLASSPATH echo $CLASSPATH java -Xms512m -Xmx768m -classpath "$CLASSPATH" com.defonds.mysql.TestMysql
Linux 下的运行情况如下:
# ps -ef | grep java root 2319 2318 0 13:51 pts/3 00:00:07 java -Xms512m -Xmx768m -classpath .:lib/commons-dbcp-1.4.jar:lib/commons-logging-1.1.1.jar:lib/commons-pool-1.5.5.jar:lib/hamcrest-core-1.3.jar:lib/hamcrest-library-1.3.jar:lib/ibatis-sqlmap-2.3.4.726.jar:lib/junit-4.10.jar:lib/mysql-connector-java-5.0.8-bin.jar:lib/spring-aop-3.1.1.RELEASE.jar:lib/spring-asm-3.1.1.RELEASE.jar:lib/spring-beans-3.1.1.RELEASE.jar:lib/spring-context-3.1.1.RELEASE.jar:lib/spring-context-support-3.1.1.RELEASE.jar:lib/spring-core-3.1.1.RELEASE.jar:lib/spring-expression-3.1.1.RELEASE.jar:lib/spring-jdbc-3.1.1.RELEASE.jar:lib/spring-jms-3.1.1.RELEASE.jar:lib/spring-orm-3.1.1.RELEASE.jar:lib/spring-tx-3.1.1.RELEASE.jar:lib/testmysql.jar com.defonds.mysql.TestMysql