Domanda

Is it possible to execute 'jmap' at different spots inside my java-programm to generate dump files. I guess one must get the own process ID and than execute the command via Runtime().exec() or similar. Didn't succeed though.

Chris

È stato utile?

Soluzione

Try:

String name = ManagementFactory.getRuntimeMXBean().getName();
String[] str = name.split("@");
Runtime.getRuntime().exec("jmap -dump:file=YOURFILENAME " + str[0]);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top