For developers who need to switch between multiple Java versions frequently, is the best approach. It installs everything in your user directory, no sudo required.
docker pull eclipse-temurin:17-jdk
When these moments happen, jstack is often the first diagnostic tool you should reach for. It prints Java stack traces of threads for a specified Java process, allowing you to see exactly what code is executing at that moment.
sudo jstack <PID>
jstack -l 12345 > threaddump_with_locks.txt