문제

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

도움이 되었습니까?

해결책

Try:

String name = ManagementFactory.getRuntimeMXBean().getName();
String[] str = name.split("@");
Runtime.getRuntime().exec("jmap -dump:file=YOURFILENAME " + str[0]);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top