首页 > 解决方案 > 启动 JProfiler 时软件报告 Missing awt 错误

问题描述

在 ubuntu 14.04 上,使用 openJDK8,当我启动 jprofiler 时,它有一些如下所示的错误。我挣扎了一天,最后还是没能启动它。

    java.lang.ExceptionInInitializerError
    at java.awt.Component.<clinit>(Component.java:593)
    at javax.swing.ImageIcon$2.run(ImageIcon.java:130)
    at javax.swing.ImageIcon.<clinit>(ImageIcon.java:100)
    at com.jprofiler.frontend.ab.a(ejt:315)
    at com.jprofiler.frontend.ab.<clinit>(ejt:47)
    at com.jprofiler.frontend.FrontendApplication.E(ejt:1038)
    at com.jprofiler.frontend.IntegrationApplication.main(ejt:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
    at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:62)
    Caused by: java.lang.NullPointerException
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
    at java.awt.Toolkit.loadLibraries(Toolkit.java:1633)
    at java.awt.Toolkit.<clinit>(Toolkit.java:1670)
    ... 20 more
    java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
    at javax.swing.ImageIcon.<init>(ImageIcon.java:198)
    at javax.swing.ImageIcon.<init>(ImageIcon.java:217)
    at com.ejt.framework.gui.eo.<init>(ejt:37)
    at com.ejt.framework.gui.eo.a(ejt:17)
    at com.jprofiler.frontend.ab.a(ejt:315)
    at com.jprofiler.frontend.ab.<clinit>(ejt:47)
    at com.jprofiler.frontend.FrontendApplication.E(ejt:1038)
    at com.jprofiler.frontend.IntegrationApplication.main(ejt:8)

    at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:62)

标签: javacrashjprofiler

解决方案


这是 Java 8u242 的一个新问题。它将很快在 JProfiler 11.1.1 中修复。临时解决方法是使用不同的 JRE 运行 JProfiler。


由于有一些兴趣,我将解释错误是什么:

此错误的原因是 JProfiler 将私有字段设置ClassLoader.sys_paths为 null 以强制重新评估java.library.path系统属性。这是向库包添加目录以便加载依赖的本机库的常见技巧。由于作为 8u242 的一部分发布的提交,必须在将该字段设置为 null 后调用新的私有方法ClassLoader.initLibraryPaths()否则无法加载本机库。


推荐阅读