I tried to run this very basic Swing program:
http://download.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java
and got an error:
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
I get the error both when I run from Eclipse and when I run from the command line.
I use a standard installation of Java 6 on Ubuntu 10.04.
Do you have any idea how to solve this?
Reading the stack trace, it appears that the FontConfiguration is failing to execute, due to a NullPointerException.
I believe this is a problem with the installation of Java. Try uninstalling and re-installing Java. I certainly can’t see any problem with the code itself. Although, the root of the stack trace show the exception started at line 261, in your main method…so if you are running the code in the example you linked to, something very odd is going on, because there is only a few dozen lines of code!