我試圖運行這個很基本的Swing程序: http://download.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java 並得到了一個錯誤:的Java Swing空指針異常
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at java.awt.Toolkit$2.run(Toolkit.java:849)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1698)
at java.awt.EventQueue.invokeLater(EventQueue.java:1002)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1292)
at ac.biu.nlp.nlp.engineml.rteflow.macro.gui.CustomProofEngine.main(CustomProofEngine.java:261)
Caused by: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1191)
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:164)
at sun.awt.FontConfiguration.<init>(FontConfiguration.java:89)
at sun.awt.motif.MFontConfiguration.<init>(MFontConfiguration.java:50)
at sun.awt.X11GraphicsEnvironment.createFontConfiguration(X11GraphicsEnvironment.java:942)
at sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:247)
at java.security.AccessController.doPrivileged(Native Method)
at sun.java2d.SunGraphicsEnvironment.<init>(SunGraphicsEnvironment.java:163)
at sun.awt.X11GraphicsEnvironment.<init>(X11GraphicsEnvironment.java:253)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
... 9 more
我得到的錯誤都當我從Eclipse中運行,當我從命令運行線。
我在Ubuntu 10.04上使用Java 6的標準安裝。
你有什麼想法如何解決這個問題嗎?
在Windows上的Eclipse Helios中正常工作。 –