code: private static JavaDumper createInstance() {
          try {
              // Try to find IBM Java dumper class.
              Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
              try {
                  // Try to find the IBM Java 7.1 dump methods.
                  Class<?>[] paramTypes = new Class<?>[] { String.class };
                  Method javaDumpToFileMethod = dumpClass.getMethod("javaDumpToFile", paramTypes);
                  Method heapDumpToFileMethod = dumpClass.getMethod("heapDumpToFile", paramTypes);
                  Method systemDumpToFileMethod = dumpClass.getMethod("systemDumpToFile", paramTypes);
                  return new IBMJavaDumperImpl(javaDumpToFileMethod, heapDumpToFileMethod, systemDumpToFileMethod);
              } catch (NoSuchMethodException e) {
                  return new IBMLegacyJavaDumperImpl(dumpClass);
              }
          } catch (ClassNotFoundException ex) {
              // Try to find HotSpot MBeans.
              ObjectName diagName;
              ObjectName diagCommandName;
              try {
                  diagName = new ObjectName("com.sun.management:type=HotSpotDiagnostic");
                  diagCommandName = new ObjectName("com.sun.management:type=DiagnosticCommand");
              } catch (MalformedObjectNameException ex2) {
                  throw new IllegalStateException(ex2);
              }
  
              MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
              if (!mbeanServer.isRegistered(diagName)) {
                  diagName = null;
              }
              if (!mbeanServer.isRegistered(diagCommandName)) {
                  diagCommandName = null;
              }
  
              return new HotSpotJavaDumperImpl(mbeanServer, diagName, diagCommandName);
          }
      }
docs: Create a dumper for the current JVM.