0

my centos Server is running the Spring boot application. I am trying to take threaddump of java process. But I cannot find jstack utility on the server. I figured out someone just installed the jre and did not install jdk, that may be the reason why jstack is missing.

Can you please let me know how can I install jstack on this server? is there any pre-install checks ? or does it involve any downtime ?

Aman35
  • 39
  • 1
  • 5
  • On Unix you can get a threaddump (on JVM's stdout) with `kill -3|-QUIT pid`; see https://stackoverflow.com/questions/16899565 https://stackoverflow.com/questions/4876274 . Otherwise yes `jstack` is in JDK; if you are using CentOS-supplied packages add the java-version-devel package matching your java-version package, otherwise be more specific about how your JRE was installed. – dave_thompson_085 May 03 '22 at 00:07
  • @dave_thompson_085 Thank you. Java -version openjdk version "1.8.0_272" OpenJDK Runtime Environment (build 1.8.0_272-b10) OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode) if you are using CentOS-supplied packages add the java-version-devel package matching your java-version package? can you please let me know How to verify this.. – Aman35 May 03 '22 at 15:30
  • Comments can't be properly formatted and are _not_ permanent, so you should put additional info _in the question_ using the edit button. However, the java _version_ tells nothing useful about how it was installed, which is what I asked about. Do `yum provides $(which java)` to find out what package, if any, it was installed from. If not, find out what file(s) you are running and where it/they came from. – dave_thompson_085 May 04 '22 at 06:20
  • Hi @dave_thompson_085, Thank you so much for your help. I was able to take a take threaddump using triggers in JDK mission control utility. – Aman35 May 16 '22 at 22:29

1 Answers1

0

You can have several java installations on the same OS by using jdk install from tar file option. You may manually install jdk to a single parent directory by making use of the .tar.gz jdk installation option. This option will enable you to download a the .tar.gz file into a new directory, then untar the downloaded file and answer some license agreement. you will see the you will find jstack in the bin directory in the directory the of the jdk you have just installed. You may need to use the full file path of this jstack file when using.

Allan K
  • 379
  • 2
  • 13