在linux环境下,使用jstack命令提示命令未找到,原因是因为安装的是openjdk。默认是只装了jre的。就是直接执行yum install openjdk
解决办法:
1、执行yum list --showduplicate | grep java-1.8 命令,查找所有1.8的jdk包
yum list --showduplicate | grep java-1.8 java-1.8.0-openjdk.x86_64 1:1.8.0.222.b10-1.el7_7 @updates java-1.8.0-openjdk-devel.x86_64 1:1.8.0.222.b10-1.el7_7 @updates java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b10-1.el7_7 @updates java-1.8.0-openjdk.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-accessibility.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-accessibility.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-accessibility-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-accessibility-debug.x86_64 java-1.8.0-openjdk-accessibility-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-accessibility-debug.x86_64 java-1.8.0-openjdk-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-debug.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-debug.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-demo.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-demo.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-demo.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-demo.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-devel.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-devel.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-devel.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-devel.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-headless.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-headless.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-javadoc-zip-debug.noarch 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-javadoc-zip-debug.noarch 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-src.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-src.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-src.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-src.x86_64 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-src-debug.i686 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.222.b03-1.el7 base java-1.8.0-openjdk-src-debug.i686 1:1.8.0.222.b10-1.el7_7 updates java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.222.b10-1.el7_7 updates
2、选择其中发布的带有devel的包进行安装,例如
java-1.8.0-openjdk-devel.i686 1:1.8.0.222.b03-1.el7 base
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.222.b03-1.el7 base
3、可以正常执行