使用CentOS 7的OpenJDK 1.8.0_202:libpng12.so.0:无法打开共享对象文件:

时间:2019-03-16 00:08:34

标签: java centos redhat

我正在使用最新的OpenJDK版本:

$ ./jdk/jre/bin/java -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.202-b08, mixed mode)

我在下面遇到链接错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/apps/jdk/jre/lib/amd64/libfontmanager.so: libpng12.so.0: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
    at sun.java2d.xr.XRSurfaceData.initXRSurfaceData(XRSurfaceData.java:85)
    at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:137)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
    at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:132)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at java.awt.Toolkit$2.run(Toolkit.java:860)
    at java.awt.Toolkit$2.run(Toolkit.java:855)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
    at sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2.java:2020)
    at javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults(BasicLookAndFeel.java:1158)
    at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:431)
    at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
    at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1577)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:539)
    at javax.swing.UIManager.setLookAndFeel(UIManager.java:579)
    at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1349)
    at javax.swing.UIManager.initialize(UIManager.java:1459)
    at javax.swing.UIManager.maybeInitialize(UIManager.java:1426)
    at javax.swing.UIManager.getUI(UIManager.java:1006)
    at javax.swing.JPanel.updateUI(JPanel.java:126)
    at javax.swing.JPanel.<init>(JPanel.java:86)
    at javax.swing.JPanel.<init>(JPanel.java:109)
    at javax.swing.JPanel.<init>(JPanel.java:117)
    at javax.swing.JRootPane.createGlassPane(JRootPane.java:546)
    at javax.swing.JRootPane.<init>(JRootPane.java:366)
    at javax.swing.JApplet.createRootPane(JApplet.java:161)
    at javax.swing.JApplet.<init>(JApplet.java:149)

在以下操作系统上进行了测试:

  • Red Hat 7.4
  • CentoS 7.4
  • CentOS 7.0

我猜想安装libpng12.x86_64可以使它工作。但这是正常现象还是最新版本的OpenJDK是否存在问题?

谢谢

2 个答案:

答案 0 :(得分:0)

libpng12软件包的一部分提供了libpng 1.2的兼容性软件包。您可以使用root身份将其安装:

yum install libpng12

但是,AdoptOpenJDK版本可能存在其他集成问题。如果可能,您应该使用Red Hat Enterprise Linux中的OpenJDK构建。该OpenJDK构建带有RPM依赖项信息,并与当前的系统libpng版本(1.5.13)链接。

您可能可以在Red Hat Enterprise Linux 7.4上从当前Red Hat Enterprise Linux 7版本安装OpenJDK RPM(目前仅扩展支持支持)。 EUS package set中不包含OpenJDK本身。

答案 1 :(得分:0)

这实际上是已报告的问题,已在GA发布后得到修复。然后AdoptOpenJDK团队重新发布了8u202-b08。

here

因此,有jdk8u202-b08的多个版本。我下载了一个新发行版,无需安装libpng12即可正常运行。

有人告诉我新版本将包含一个AdoptOpenJDK特定的内部版本号,以便能够区分。