This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run AWT program on Linux from telnet!!!

 
James wu
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/ ).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic