Hi, I need your help! What I want to do is that my Java program is running on Linux and called from telnet. The program will just draw some charts and save them as PNG file by using a pure java PNG encoder, WITHOUT displaying. But when I run it using telnet, I got this: Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:5 8) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:120) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi ronment.java:58) at java.awt.Font.initializeFont(Font.java:264) at java.awt.Font.<init>(Font.java:298) at SCTester.<clinit>(SCTester.java:30) But if I run it from a X window on linux it will be ok. Is there any way that can help me to run my program from telnet. I am not good at linux and x server, so i do need your help! Thanks J
This is a well-known problem with Java on Linux. The graphics subsysystem in the JRE stupidly assumes that there is an X-Windows system running on the system which it can use for things like allocating image buffers. There are two types of fix. You can either install an X-Windows simulator such as xvfb (look up xvfb in any good search engine, or you may have it already) or a replacement graphics subsystem such as PJA (from http://www.eteks.com/pja/en/ ).