Menu

#30 API demands X server to get smileys

v_0.2_(beta)
open
nobody
5
2009-04-06
2003-12-22
No

If you attempt to run a Hamsam program on a console,
without an X server present, you get the following
exception...
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:125)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at
sun.awt.motif.MToolkit.<clinit>(MToolkit.java:72)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at java.awt.Toolkit$2.run(Toolkit.java:712)
at
java.security.AccessController.doPrivileged(Native Method)
at
java.awt.Toolkit.getDefaultToolkit(Toolkit.java:703)
at javax.swing.ImageIcon.<init>(ImageIcon.java:119)
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at
hamsam.protocol.yahoo.Util.loadSmileys(Util.java:192)
at
hamsam.protocol.yahoo.YahooProtocol.<init>(YahooProtocol.java:143)
at
hamsam.protocol.ProtocolManager.<clinit>(ProtocolManager.java:60)

As can be seen it seems to want to create some image
icons of some sort, even though they are not yet called
for.

Suggest not attempting to call AWT to get images until
something the application does demands them, otherwise
daemon and console programs using hamsam are not easy
to do.

Discussion

  • Bogdan Onoiu

    Bogdan Onoiu - 2003-12-31

    Logged In: YES
    user_id=624085

    Have you tried this?
    http://forum.java.sun.com/thread.jsp?
    forum=31&thread=51029

    I mean "-Djava.awt.headless=true", if u use the JDK 1.4
    I am planning to start using the hamsam lib as a console
    application as well. Let me know if it helps, read the whole
    article.
    Yet you have a point in changing the API not to use the AWT
    until an image is required or the performance impact is still
    payed (for accessing AWT lib via this loopback).

     
  • Brad Templeton

    Brad Templeton - 2003-12-31

    Logged In: YES
    user_id=785028

    Yes, setting this system property seems to stop the
    exception. No idea if smileys are still working as I am not
    using them in this app.

     
  • Raghu Kaippully

    Raghu Kaippully - 2009-04-06
    • assigned_to: kraghu --> nobody
     

Log in to post a comment.

MongoDB Logo MongoDB