wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes Run AWT program on Linux from telnet!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Run AWT program on Linux from telnet!!!" Watch "Run AWT program on Linux from telnet!!!" New topic

Run AWT program on Linux from telnet!!!

James wu

Joined: Feb 20, 2001
Posts: 5
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
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi
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
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
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/ ).

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link: http://aspose.com/file-tools
subject: Run AWT program on Linux from telnet!!!
It's not a secret anymore!