【问题标题】:jpod library not working outside eclipsejpod库在eclipse之外不起作用
【发布时间】:2014-05-19 07:50:24
【问题描述】:

如果我从 Eclipse 运行项目 - 没关系。如果我将项目作为可运行的 jar 异常运行:

.Exception in thread "main" java.lang.ExceptionInInitializerError
        at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.getLib
rary(Unknown Source)
        at de.intarsys.pdf.platform.cwt.font.freetype.FreetypeFontFactory.create
PlatformFont(Unknown Source)
        at de.intarsys.pdf.platform.cwt.rendering.CSPlatformDevice.textSetFont(U
nknown Source)
        at de.intarsys.pdf.content.CSDeviceBasedInterpreter.render_Tf(Unknown So
urce)
        at de.intarsys.pdf.content.CSInterpreter.process(Unknown Source)
        at de.intarsys.pdf.content.CSInterpreter.process(Unknown Source)
        at de.intarsys.pdf.content.CSDeviceBasedInterpreter.process(Unknown Sour
ce)
        at RenderDoc.renderPage(RenderDoc.java:75)
        at RenderDoc.renderPages(RenderDoc.java:97)
        at RenderDoc.run(RenderDoc.java:139)
        at RenderDoc.main(RenderDoc.java:48)
Caused by: java.lang.NullPointerException: no native interface available
        at de.intarsys.nativec.api.NativeInterface.set(Unknown Source)
        at de.intarsys.nativec.api.NativeInterface.get(Unknown Source)
        at de.intarsys.cwt.freetype.nativec._FTNI.init(Unknown Source)
        at de.intarsys.cwt.freetype.nativec._FTNI.<init>(Unknown Source)
        at de.intarsys.cwt.freetype.Freetype.<clinit>(Unknown Source)
        ... 11 more

我的系统 windows7 64 位,java 8 64 位。我认为问题在于,在 Eclipse 之外没有看到 freetype.dll。我在 jar(jpod 依赖项)中找到了它。我怎样才能在包装 jar 中正确包含这个 dll,为什么它可以在 eclipse 中工作?

【问题讨论】:

    标签: java eclipse java-native-interface jna freetype


    【解决方案1】:

    这个问题是从五月开始的,但如果有人仍然有这个问题...... Freetype dll 会自动从 jar 文件中提取到您的临时文件夹并从那里加载。但是您收到的消息意味着无法初始化 JNA 网桥。这是您的类路径的问题。您的类路径中需要 jna.jar 和其他 jpod 依赖项。

    【讨论】:

      【解决方案2】:

      如果在a predefined set of locations 中找到共享库,JNA 可以自动提取它们。

      java.classpath 的值很可能在 Eclipse 下运行时与独立运行时不同(在启动时打印值以查看)。您需要确保您的类路径在这两种情况下都是等效的,并且共享库包含在您的最终部署中,位于 JNA 可以访问并最终使用的路径下(如果 JNA 不能,将共享库包含在 jar 中是没有用的将其提取到系统可以加载的位置)。

      【讨论】:

        【解决方案3】:

        我遇到了同样的问题,无法在我的 Windows 系统上加载本机库。

        原因:

        我使用了 WebSphere Java 8 Runtime,它无法正确提取本机库。

        解决方案:

        使用官方 Oracle JRE 8。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-06-23
          • 2018-08-15
          相关资源
          最近更新 更多