0

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

1 Answer 1

3

Try:

String name = ManagementFactory.getRuntimeMXBean().getName();
String[] str = name.split("@");
Runtime.getRuntime().exec("jmap -dump:file=YOURFILENAME " + str[0]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.