Java8 ArchLinux arm font NullPointerException



嗨,我有一个基于 swing 的 java 应用程序,它在 kali 发行版中的计算机上运行良好

我想在我的基于 ArchLinux 的 raspBerry pi3 b+ 中运行这个应用程序 jar,我成功安装了支持 LXDE 的操作系统,我也在使用 openjdk 完全支持 1 8 171

当使用命令java -jar dvr运行时.jar我面临着从字体管理器中产生的NullPointerException

java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
at sun.font.SunFontManager$2.run(SunFontManager.java:431)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<init>(SunFontManager.java:376)
at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at sun.font.SunFontManager.getInstance(SunFontManager.java:250)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:264)
at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1113)
at javax.swing.JComponent.getFontMetrics(JComponent.java:1626)
at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(BasicLabelUI.java:245)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)
at javax.swing.tree.DefaultTreeCellRenderer.getPreferredSize(DefaultTreeCellRenderer.java:565)
at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2815)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:492)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1360)
at javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:738)
at javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:109)
at javax.swing.plaf.basic.BasicTreeUI.setModel(BasicTreeUI.java:412)
at javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(BasicTreeUI.java:3414)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at java.awt.Component.firePropertyChange(Component.java:8428)
at javax.swing.JTree.setModel(JTree.java:882)
at javax.swing.JTree.<init>(JTree.java:670)
at javax.swing.JTree.<init>(JTree.java:645)
at javax.swing.JTree.<init>(JTree.java:629)
at com.wanasis.vlc.view.JCheckBoxDragableTree.<init>(JCheckBoxDragableTree.java:88)
at com.wanasis.vlc.view.JCheckBoxDragableTree.<init>(JCheckBoxDragableTree.java:72)
at com.wanasis.vlc.control.MainFrameBuilder.build(MainFrameBuilder.java:27)
at com.wanasis.vlc.SwingMain$1.run(SwingMain.java:56)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

如何设置摆动 LAF 以使用系统当前字体?

我试过这个,但没有结果

UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
UIManager.getLookAndFeelDefaults()
.put("defaultFont", new Font("Arial", Font.BOLD, 14));

功劳 – @Sergiy Medvynskyy -

我使用了java字体部分来获得这个想法

我使用 pacman 工具搜索了一些字体pacman -Ss font然后我用谷歌搜索它们并选择了我想要的字体包,并将我的应用程序切换为使用Times字体

注意:不要忘记通过 -Sypacman -Sy更新 pacman,-Ss 是一个软件包搜索工具,在存储库/之后使用软件包的名称,例如extra/mypack-alpha v.x.y.z安装mypack-alpha使用pacman -S mypack-alpha

相关内容

  • 没有找到相关文章

最新更新