You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何检查Linux机器是否使用Apache Commons Text库

检查Linux机器是否使用Apache Commons Text库的方法

你之前用的ldconfig -p | grep org.apache.commons:commons-text没结果很正常,因为ldconfig是用来管理**C/C++共享库(.so文件)**的,而Apache Commons Text是Java类库,以JAR包形式存在,所以这个命令完全不适用。

常用检查方法

1. 查找系统中是否存在commons-text的JAR包

用find命令遍历文件系统查找相关JAR:

find / -name "*commons-text*.jar" 2>/dev/null
  • 2>/dev/null用来过滤掉权限不足导致的错误信息,避免输出冗余内容。

2. 检查正在运行的Java进程是否加载了该库

如果目标库被Java进程使用,可通过以下方式排查:

  • 快速筛选包含commons-text的Java进程:
ps aux | grep java | grep -i commons-text
  • 针对特定进程(替换<pid>为进程ID),查看其类路径或已加载的类:
# 查看进程类路径
jcmd <pid> VM.classpath | grep -i commons-text

# 查看已加载的类
jmap -histo <pid> | grep org.apache.commons.text

3. 通过系统包管理器检查(如果是通过包管理安装)

  • Debian/Ubuntu系列:
dpkg -l | grep commons-text
  • RHEL/CentOS/Fedora系列:
# 旧版用yum
yum list installed | grep commons-text

# 新版用dnf
dnf list installed | grep commons-text

内容的提问来源于stack exchange,提问作者Yope

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 01:05:18