centos 安装java 报错:java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

java安装的时候,一个依赖的so文件提示报错

ldd /usr/bin/java

 linux-vdso.so.1 =>  (0x00007fffba769000)
 libpthread.so.0 => /lib64/libpthread.so.0 (0x00000038c4000000)
 libjli.so => not found
 libdl.so.2 => /lib64/libdl.so.2 (0x0000003da7c00000)
 libc.so.6 => /lib64/libc.so.6 (0x0000003da7400000)
 /lib64/ld-linux-x86-64.so.2 (0x0000003da6c00000)

其实这个so文件在java的安装包中是有的,只是没有添加了ld_path 里面,

解决办法:

rpm -ql jdk1.8.0_45|grep libjli

/usr/java/jdk1.8.0_45/jre/lib/amd64/jli/libjli.so
/usr/java/jdk1.8.0_45/lib/amd64/jli/libjli.so

然后将
/usr/java/jdk1.8.0_45/jre/lib/amd64/jli/

/usr/java/jdk1.8.0_45/lib/amd64/jli/

添加到文件:
/etc/ld.so.conf中,

然后执行
ldconfig 即可

posted @ 2021-01-20 00:53  rab3it  阅读(1501)  评论(0编辑  收藏  举报