背景
服务器的jdk通过yum 安装的,要用jps查询pid,提示找不到命令
yum install -y java-1.8.0-openjdk.x86_64
一、jps命令无法找到
[dev@hgh-tob-hsbc-dev-003 ~]$ jps
-bash: jps: command not found
二、检查基础Java环境
[dev@hgh-tob-hsbc-dev-003 ~]$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
三、查Java安装的目录
[root@hgh-tob-hsbc-dev-003 java]# which java
/bin/java
[root@hgh-tob-hsbc-dev-003 java]# ls -lrt /bin/java
lrwxrwxrwx 1 root root 22 May 4 2023 /bin/java -> /etc/alternatives/java
[root@hgh-tob-hsbc-dev-003 java]# ls -lrt /etc/alternatives/java
lrwxrwxrwx 1 root root 73 May 4 2023 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/bin/java
四、安装目录无jps命令
五、需要安装openjdk-devel包
yum install -y java-1.8.0-openjdk-devel.x86_64
六、安装后执行结果
[root@hgh-tob-hsbc-dev-003 bin]# jps
52391 Jps