jfinal.bat 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. @echo off
  2. rem -------------------------------------------------------------------------
  3. rem
  4. rem 使用说明:
  5. rem
  6. rem 1: 该脚本用于别的项目时只需要修改 MAIN_CLASS 即可运行
  7. rem
  8. rem 2: JAVA_OPTS 可通过 -D 传入 undertow.port 与 undertow.host 这类参数覆盖
  9. rem 配置文件中的相同值此外还有 undertow.resourcePath, undertow.ioThreads
  10. rem undertow.workerThreads 共五个参数可通过 -D 进行传入
  11. rem
  12. rem 3: JAVA_OPTS 可传入标准的 java 命令行参数,例如 -Xms256m -Xmx1024m 这类常用参数
  13. rem
  14. rem
  15. rem -------------------------------------------------------------------------
  16. setlocal & pushd
  17. rem 启动入口类,该脚本文件用于别的项目时要改这里
  18. set MAIN_CLASS=com.jfinal.club.common.JFinalClubConfig
  19. rem Java 命令行参数,根据需要开启下面的配置,改成自己需要的,注意等号前后不能有空格
  20. rem set "JAVA_OPTS=-Xms256m -Xmx1024m -Dundertow.port=80 -Dundertow.host=0.0.0.0"
  21. rem set "JAVA_OPTS=-Dundertow.port=80 -Dundertow.host=0.0.0.0"
  22. if "%1"=="start" goto normal
  23. if "%1"=="stop" goto normal
  24. if "%1"=="restart" goto normal
  25. goto error
  26. :error
  27. echo Usage: jfinal.bat start | stop | restart
  28. goto :eof
  29. :normal
  30. if "%1"=="start" goto start
  31. if "%1"=="stop" goto stop
  32. if "%1"=="restart" goto restart
  33. goto :eof
  34. :start
  35. set APP_BASE_PATH=%~dp0
  36. set CP=%APP_BASE_PATH%config;%APP_BASE_PATH%lib\*
  37. echo starting jfinal undertow
  38. java -Xverify:none %JAVA_OPTS% -cp %CP% %MAIN_CLASS%
  39. goto :eof
  40. :stop
  41. set "PATH=%JAVA_HOME%\bin;%PATH%"
  42. echo stopping jfinal undertow
  43. for /f "tokens=1" %%i in ('jps -l ^| find "%MAIN_CLASS%"') do ( taskkill /F /PID %%i )
  44. goto :eof
  45. :restart
  46. call :stop
  47. call :start
  48. goto :eof
  49. endlocal & popd
  50. pause