Class JVisualVM


  • public class JVisualVM
    extends Java
    A helper class for the jvisualvm utility.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • JVisualVM

        public JVisualVM()
    • Method Detail

      • hasCustomBinary

        public static boolean hasCustomBinary()
        Checks whether the user defined a custom binary.
        Returns:
        true if custom binary
      • isAvailable

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

        public static String getExecutablePath()
        Returns the full path of the JVisualVM 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 ("--nosplash -J-Xmx512m") for jvisualvm.
        Returns:
        the default options
      • execute

        public static String execute​(long pid)
        Executes jvisualvm 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()
      • execute

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

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

        public static String getPropertiesHelp()
        Generates a help string for the properties.
        Returns:
        the help string
      • getProperties

        public static Properties getProperties()
        Returns the properties.
        Returns:
        the properties