jconsole.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. DIRNAME=`dirname "$0"`
  3. GREP="grep"
  4. # Use the maximum available, or set MAX_FD != -1 to use that
  5. MAX_FD="maximum"
  6. # OS specific support (must be 'true' or 'false').
  7. cygwin=false;
  8. darwin=false;
  9. linux=false;
  10. case "`uname`" in
  11. CYGWIN*)
  12. cygwin=true
  13. ;;
  14. Darwin*)
  15. darwin=true
  16. ;;
  17. Linux)
  18. linux=true
  19. ;;
  20. esac
  21. # For Cygwin, ensure paths are in UNIX format before anything is touched
  22. if $cygwin ; then
  23. [ -n "$JBOSS_HOME" ] &&
  24. JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  25. [ -n "$JAVA_HOME" ] &&
  26. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  27. [ -n "$JAVAC_JAR" ] &&
  28. JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  29. fi
  30. # Setup JBOSS_HOME
  31. RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
  32. if [ "x$JBOSS_HOME" = "x" ]; then
  33. # get the full path (without any relative bits)
  34. JBOSS_HOME=$RESOLVED_JBOSS_HOME
  35. else
  36. SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
  37. if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
  38. echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
  39. echo ""
  40. fi
  41. fi
  42. export JBOSS_HOME
  43. # Setup the JVM
  44. if [ "x$JAVA" = "x" ]; then
  45. if [ "x$JAVA_HOME" != "x" ]; then
  46. JAVA="$JAVA_HOME/bin/java"
  47. else
  48. echo "JAVA_HOME is not set. Unable to locate the jars needed to run jconsole."
  49. exit 2
  50. fi
  51. fi
  52. if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  53. JBOSS_MODULEPATH="$JBOSS_HOME/modules"
  54. fi
  55. # For Cygwin, switch paths to Windows format before running java
  56. if $cygwin; then
  57. JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  58. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  59. JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  60. JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
  61. JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
  62. fi
  63. CLASSPATH=$JAVA_HOME/lib/jconsole.jar
  64. CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
  65. MODULES="org/jboss/remoting-jmx org/jboss/remoting3 org/jboss/logging org/jboss/xnio org/jboss/xnio/nio org/jboss/sasl org/jboss/marshalling org/jboss/marshalling/river org/jboss/as/cli org/jboss/staxmapper org/jboss/as/protocol org/jboss/dmr org/jboss/as/controller-client org/jboss/threads"
  66. for MODULE in $MODULES
  67. do
  68. for JAR in `cd "$JBOSS_MODULEPATH/system/layers/base/$MODULE/main/" && ls -1 *.jar`
  69. do
  70. CLASSPATH="$CLASSPATH:$JBOSS_MODULEPATH/system/layers/base/$MODULE/main/$JAR"
  71. done
  72. done
  73. echo CLASSPATH $CLASSPATH
  74. jconsole -J-Djava.class.path="$CLASSPATH"