1.美图
2.背景
[root@1 /]# jstack -l 3859 >> aa.txt
bash: jstack: command not found
[root@1 /]#
[root@1 /]# cat ~/.bash_profile
PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/jdk64/jdk1.8.0_112/bin/
export PATH
[root@1 /]# source bash_profile
[root@1 /]# /usr/jdk64/jdk1.8.0_112/bin/jstack -l 3859 >> a.txt
3859: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
[root@1 /]#
报错是因为 当前pid非当前用户所创建
可以执行这个命令
su - $( ps -ef|grep 3859|grep -v grep|awk '{print $1}') -c "/usr/jdk64/jdk1.8.0_112/bin/jstack -l 3859"