无法在 Solaris 上初始化类 sun.awt.X11GraphicsEnvironment$ export DISPLAY=$ unset DISPLAY

2022-09-02 02:26:31

我在 Solaris 计算机上运行安装程序时遇到此错误:

Installing...
-------------

 [==================|==================|==================|==================]
 [---Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

Stack Trace:
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
        at sun.awt.X11FontManager.isHeadless(X11FontManager.java:487)
        at sun.awt.X11FontManager.getFontPath(X11FontManager.java:767)
        at sun.font.SunFontManager.getPlatformFontPath(SunFontManager.java:3288)
        at sun.font.SunFontManager$11.run(SunFontManager.java:3314)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.font.SunFontManager.loadFonts(SunFontManager.java:3310)
        at sun.awt.X11FontManager.loadFonts(X11FontManager.java:439)
        at sun.font.SunFontManager.findFont2D(SunFontManager.java:2347)
        at sun.font.SunFontManager.findFont2D(SunFontManager.java:2285)
        at java.awt.Font.getFont2D(Font.java:498)
        at java.awt.Font.getFamily(Font.java:1187)
        at java.awt.Font.getFamily_NoClientCode(Font.java:1161)
        at java.awt.Font.getFamily(Font.java:1153)
        at ZeroGrs.a(DashoA10*..)
        at ZeroGrs.a(DashoA10*..)
        at ZeroGrs.a(DashoA10*..)
        at ZeroGrs.a(DashoA10*..)
        at ZeroGrs.a(DashoA10*..)
        at ZeroGrs.a(DashoA10*..)
        at com.zerog.ia.installer.actions.InstallUninstaller.a(DashoA10*..)
        at com.zerog.ia.installer.actions.InstallUninstaller.d(DashoA10*..)
        at com.zerog.ia.installer.actions.InstallUninstaller.installSelf(DashoA10*..)
        at com.zerog.ia.installer.InstallablePiece.install(DashoA10*..)
        at com.zerog.ia.installer.actions.InstallDirectory.install(DashoA10*..)
        at com.zerog.ia.installer.actions.InstallDirectory.install(DashoA10*..)
        at com.zerog.ia.installer.InstallablePiece.install(DashoA10*..)
        at com.zerog.ia.installer.GhostDirectory.install(DashoA10*..)
        at com.zerog.ia.installer.InstallablePiece.install(DashoA10*..)
        at com.zerog.ia.installer.Installer.install(DashoA10*..)
        at com.zerog.ia.installer.LifeCycleManager.b(DashoA10*..)
        at com.zerog.ia.installer.LifeCycleManager.a(DashoA10*..)
        at com.zerog.ia.installer.Main.main(DashoA10*..)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.zerog.lax.LAX.launch(DashoA10*..)
        at com.zerog.lax.LAX.main(DashoA10*..)

我尝试配置,但它不起作用!JAVA_OPTS-Djava.awt.headless=true

有其他解决方案吗?


答案 1

解决了问题。这是我的个人资料,我已将我的DISPLAY设置为一个不活跃的主机。我已经正确设置了它,它工作了。

$ export DISPLAY=

$ unset DISPLAY


答案 2

尝试在 servlet 的构造函数中运行此代码

System.setProperty("java.awt.headless", "true"); 

在服务器的启动脚本中使用此参数:

-Djava.awt.headless=true

以下是当您想要创建具有自动大小列的工作表时,Apache POI中记录并解释了此问题的示例。


推荐