1、linux下shell啓動javajava
#!/bin/shlinux
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jreshell
# JVM_OPT="$JVM_OPT -Xdebug -Xrunjdwp:transport=dt_socket,address=32044,server=y,suspend=n"windows
APP_HOME=/opt/testless
APP_MAINCLASS=http.RuntimeCMDjvm
CLASSPATH=$APP_HOME/classes
for i in "$APP_HOME"/lib/*.jar; do
CLASSPATH="$CLASSPATH":"$i"
done
#java虛擬機啓動參數
JAVA_OPTS="-ms512m -mx512m -Xmn256m -Djava.awt.headless=true -XX:MaxPermSize=128m"socket
JAVA_CMD=" $JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $APP_MAINCLASS"
echo $JAVA_CMD
su - root -c "$JAVA_CMD"spa
2、windows下bat啓動java程序debug
@echo off
set SCRIPT_DIR=%~dp0code
rem set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=44444,server=y,suspend=y
set CLASS_PATH=%CLASS_PATH%;lib\\testhttpclient.jar
set CLASS_PATH=%CLASS_PATH%;lib\\httpcore-4.4.4.jar
set CLASS_PATH=%CLASS_PATH%;lib\\httpclient-4.5.2.jar
set CLASS_PATH=%CLASS_PATH%;lib\\commons-logging-1.2.jar
set CLASS_PATH=%CLASS_PATH%;lib\\commons-codec-1.9.jar
set MAIN_CLASS=http.TestHttps
rem set JAVA_HOME="C:/Program Files/Java/jdk1.7.0_17"
"C:/Program Files/Java/jdk1.7.0_17/bin/Java" -cp %CLASS_PATH% %DEBUG_OPTS% -Dcom.env.home=%CD% %MAIN_CLASS% %1