Class JConsole


  • public class JConsole
    extends Java
    A helper class for the jconsole utility.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • JConsole

        public JConsole()
    • Method Detail

      • isAvailable

        public static boolean isAvailable()
        Checks whether jconsole is available at all.
        Returns:
        true if available
      • getExecutablePath

        public static String getExecutablePath()
        Returns the full path of the JConsole executable, if possible.
        Returns:
        the full path of the executable if possible, otherwise just the executable
      • getDefaultOptions

        public static String getDefaultOptions()
        Returns the default options ("-histo:live") for jmap.
        Returns:
        the default options
      • execute

        public static String execute​(long pid)
        Executes jconsole with default options and returns the output.
        Parameters:
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output
        See Also:
        getDefaultOptions(), Java#AUTO_PID
      • execute

        public static String execute​(String options,
                                     long pid)
        Executes jconsole with default options and returns the output.
        Parameters:
        options - additional options for jconsole
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output
        See Also:
        getDefaultOptions(), Java#AUTO_PID
      • execute

        public static String execute​(String executable,
                                     String options,
                                     long pid)
        Executes jconsole and returns the output.
        Parameters:
        executable - the jconsole executable to use
        options - additional options for jconsole
        pid - the process ID of the JVM to connect to, gets determined automatically if AUTO_PID
        Returns:
        the output, if any
        See Also:
        Java#AUTO_PID