(原創) 如何解決Java在Linux上『libXp.so.6: cannot open shared object file: No such file or directory』的錯誤訊息? (OS) (Linux) (CentOS) (Java)
Abstract
libXp.so.6是XFree86的一個library,通常在執行由Java寫的GUI時,會遇到以上的錯訊訊息。
Introduction
執行環境:CentOS 5.1 + JDK 1.4.2.17
由Java寫的GUI,如matlab、Oracle,在執行時可能出現以下錯誤訊息
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.2_17/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
原因是在/usr/lib下找不到libXp.so.6這個library。
Solution
Step 1:
[root@localhost /]# yum install libXp.so.6
執行結果
[root@localhost /]# yum install libXp.so.6
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for libXp to pack into transaction set.
libXp-1.0.0-8.1.el5.i386. 100% |=========================| 6.9 kB 00:00
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libXp i386 1.0.0-8.1.el5 base 23 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 23 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libXp-1.0.0-8.1.el 35% |======== | 8.0 kB (1/1): libXp-1.0.0-8.1.el 70% |================= | 16 kB (1/1): libXp-1.0.0-8.1.el 100% |=========================| 23 kB 00:03
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libXp Installing: libXp ##################### Installing: libXp ##################### Installing: libXp ###################### Installing: libXp ###################### Installing: libXp ######################## Installing: libXp ######################## Installing: libXp ######################## Installing: libXp ######################### [1/1]
Installed: libXp.i386 0:1.0.0-8.1.el5
Complete!
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for libXp to pack into transaction set.
libXp-1.0.0-8.1.el5.i386. 100% |=========================| 6.9 kB 00:00
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libXp i386 1.0.0-8.1.el5 base 23 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 23 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libXp-1.0.0-8.1.el 35% |======== | 8.0 kB (1/1): libXp-1.0.0-8.1.el 70% |================= | 16 kB (1/1): libXp-1.0.0-8.1.el 100% |=========================| 23 kB 00:03
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libXp Installing: libXp ##################### Installing: libXp ##################### Installing: libXp ###################### Installing: libXp ###################### Installing: libXp ######################## Installing: libXp ######################## Installing: libXp ######################## Installing: libXp ######################### [1/1]
Installed: libXp.i386 0:1.0.0-8.1.el5
Complete!