jconsole.bat 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. @echo off
  2. rem -------------------------------------------------------------------------
  3. rem jconsole script for Windows
  4. rem -------------------------------------------------------------------------
  5. rem
  6. rem A script for running jconsole with the remoting-jmx libraries on the classpath.
  7. rem $Id$
  8. @if not "%ECHO%" == "" echo %ECHO%
  9. @if "%OS%" == "Windows_NT" setlocal
  10. if "%OS%" == "Windows_NT" (
  11. set "DIRNAME=%~dp0%"
  12. ) else (
  13. set DIRNAME=.\
  14. )
  15. pushd %DIRNAME%..
  16. set "RESOLVED_JBOSS_HOME=%CD%"
  17. popd
  18. if "x%JBOSS_HOME%" == "x" (
  19. set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
  20. )
  21. pushd "%JBOSS_HOME%"
  22. set "SANITIZED_JBOSS_HOME=%CD%"
  23. popd
  24. if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
  25. echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
  26. )
  27. set DIRNAME=
  28. if "%OS%" == "Windows_NT" (
  29. set "PROGNAME=%~nx0%"
  30. ) else (
  31. set "PROGNAME=jdr.bat"
  32. )
  33. rem Setup JBoss specific properties
  34. if "x%JAVA_HOME%" == "x" (
  35. echo JAVA_HOME is not set. Unable to locate the jars needed to run jconsole.
  36. goto END
  37. )
  38. rem Find jboss-modules.jar, or we can't continue
  39. if exist "%JBOSS_HOME%\jboss-modules.jar" (
  40. set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
  41. ) else (
  42. echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
  43. echo Please check that you are in the bin directory when running this script.
  44. goto END
  45. )
  46. rem Set default module root paths
  47. if "x%JBOSS_MODULEPATH%" == "x" (
  48. set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
  49. )
  50. rem Setup The Classpath
  51. set CLASSPATH=%JAVA_HOME%\lib\jconsole.jar
  52. set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
  53. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting-jmx\main"
  54. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\remoting3\main"
  55. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\logging\main"
  56. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\xnio\main"
  57. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\xnio\nio\main"
  58. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\sasl\main"
  59. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\marshalling\main"
  60. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\marshalling\river\main"
  61. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\as\cli\main"
  62. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\staxmapper\main"
  63. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\as\protocol\main"
  64. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\dmr\main"
  65. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\as\controller-client\main"
  66. call :SearchForJars "%JBOSS_MODULEPATH%\system\layers\base\org\jboss\threads\main"
  67. rem echo %CLASSPATH%
  68. "%JAVA_HOME%\bin\jconsole.exe" -J"-Djava.class.path=%CLASSPATH%"
  69. :END
  70. goto :EOF
  71. :SearchForJars
  72. set NEXT_MODULE_DIR=%1
  73. call :DeQuote NEXT_MODULE_DIR
  74. pushd %NEXT_MODULE_DIR%
  75. for %%j in (*.jar) do call :ClasspathAdd "%NEXT_MODULE_DIR%\%%j"
  76. popd
  77. goto :EOF
  78. :ClasspathAdd
  79. set NEXT_JAR=%1
  80. call :DeQuote NEXT_JAR
  81. set CLASSPATH=%CLASSPATH%;%NEXT_JAR%
  82. goto :EOF
  83. :DeQuote
  84. for /f "delims=" %%A in ('echo %%%1%%') do set %1=%%~A
  85. goto :EOF
  86. :EOF