6

Jstack is a thread stack analysis tool that comes with jdk. I can use this command to view or export thread stack information in a Java application.

Does OpenJDK have a tool similar to jstack (Oracle Java)?

Andrew8460958
  • 147
  • 1
  • 10

2 Answers2

2

Based on the comment from Curtis Yallop.

If you are on CentOs/RedHat like me, and have java but no jstack, you may have installed "java JRE" basically. If you also have no javac (but have java), then install openjdk-devel package and both will now show up.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
1

Here are the tools listed that are in openjdk:

http://openjdk.java.net/tools/

jstack belongs to the Serviceability tools.

Edit: You can find jstack in the bin folder of the openjdk where all other executables can be found like java and javac.

In my case (mac OS) the path looks like the following: jdk-11.0.1.jdk/Contents/Home/bin/

C.Schone
  • 71
  • 1
  • 2
  • 9
  • Hi, Schone, I use openjdk version "1.8.0_161" in AWS EC2 , but it don't include jstack. [root@ip-10-0-1-132 bin]# java -version openjdk version "1.8.0_161" OpenJDK Runtime Environment (build 1.8.0_161-b14) OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode) [root@ip-10-0-1-132 bin]# find /usr/bin/ -name jstack8 /usr/bin/jstack8 [root@ip-10-0-1-132 bin]# /usr/bin/jstack8 bash: /usr/bin/jstack8: No such file or directory – Andrew8460958 Dec 22 '18 at 13:50
  • Where can openjdk's jstack be downloaded to – Andrew8460958 Dec 22 '18 at 13:54
  • Hey Andrew, sorry for the late reply. jstack should be included in the bin folder where all other executables can be found like java and javac. In my openjdk 11 folder it is at following path (mac os in my case): jdk-11.0.1.jdk/Contents/Home/bin/ – C.Schone Dec 30 '18 at 20:37
  • Thanks very much ! – Andrew8460958 Jan 02 '19 at 13:01
  • You're welcome! I edited my answer so it would be nice if you could accept it ;) – C.Schone Jan 03 '19 at 11:23
  • 4
    You need the devel package (JDK not JRM). eg on CentOS `yum list "java*"` `yum install java-1.8.0-openjdk-devel.x86_64` `repoquery -l java-1.8.0-openjdk-devel.x86_64 | grep jstack` – Curtis Yallop Nov 07 '19 at 20:40
  • On debian and derivates, you can install the JDK with `sudo apt-get install openjdk-9-jdk` – Christoph Bimminger Nov 27 '20 at 21:40