public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }