If you’re looking for a more visual approach, Java Mission Control (JMC) or VisualVM can help.
- Open JMC or VisualVM.
- Attach it to the running process.
- Navigate to the Heap Dump option and generate it with a single click.
This method is super helpful if you prefer a GUI-based approach instead of command-line tools.