bat,sh文件执行Java

  1. 1.xxxxx.bat
  2. echo using Java %JAVA_HOME%/bin/java 
  3. set path=G:/Program Files/Java/jdk1.6.0_16/bin 
  4. set CLASS=F:/workspace/ClientLongYuan/bin/classes 
  5. set CLASS_PATH=.;%CLASS% 
  6. set LIB=F:/workspace/ClientLongYuan/bin/classes/lib 
  7. set CLASS_PATH=%CLASS_PATH%;%LIB%/classes12.jar 
  8. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-beanutils-1.6.jar 
  9. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-beanutils.jar 
  10. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-codec-1.3.jar 
  11. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-collections-3.2.jar 
  12. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-collections.jar 
  13. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-configuration-1.4.jar 
  14. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-digester.jar 
  15. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-discovery-0.2.jar 
  16. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-httpclient.jar 
  17. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-lang-2.1.jar 
  18. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-lang-2.3.jar 
  19. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-logging-1.0.4.jar 
  20. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-logging-api-1.1.jar 
  21. set CLASS_PATH=%CLASS_PATH%;%LIB%/commons-validator.jar 
  22. set CLASS_PATH=%CLASS_PATH%;%LIB%/jdom.jar 
  23. set CLASS_PATH=%CLASS_PATH%;%LIB%/log4j-1.2.11.jar 
  24. java -classpath %CLASS_PATH% com.timer.ImageTimer 
  25. pause 

2.xxx.sh

Java代码

  1. #!/bin/bash 
  2. for JAVA in "$JAVA_HOME/bin/java" "/usr/bin/java" "/usr/local/bin/java"
  3. do
  4. if [ -x $JAVA ] 
  5.   then 
  6. break
  7.   fi 
  8. done 
  9. if [ ! -x $JAVA ] 
  10. then 
  11.   echo "Unable to locate Java. Please set JAVA_HOME environment variable."
  12.   exit 
  13. fi 
  14. exec $JAVA -Djava.awt.headless=true -classpath .:lib/classes12.jar:lib/commons-beanutils-1.6.jar:lib/commons-beanutils.jar:lib/commons-codec-1.3.jar:lib/commons-collections-3.2.jar:lib/commons-collections.jar:lib/commons-configuration-1.4.jar:lib/commons-digester.jar:lib/commons-discovery-0.2.jar:lib/commons-httpclient.jar:lib/commons-lang-2.1.jar:lib/commons-lang-2.3.jar:lib/commons-logging-1.0.4.jar:lib/commons-validator.jar:lib/jdom.jar:lib/log4j-1.2.11.jar:conf:$CLASSPATH com.timer.ImageTimer 

你可能感兴趣的:(java,Class,Path)