JDK-4119902 : Creating a java.awt.Applet tries to connect to X server
  • Type: Bug
  • Component: tools
  • Sub-Component: appletviewer
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1998-03-16
  • Updated: 2004-11-26
  • Resolved: 2004-11-26
Related Reports
Relates :  
Description
If you try to create a new Applet, and there's no available window environment,
the initializer will fail with an InternalError.  (unset DISPLAY, xhost -, create
applet object under Solaris.)

This is a side-effect of Component really, but I want a sandbox that I can run
in the JavaTest framework without needing a GUI.  If not Applet, then what?

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 
        at java.lang.Class.forName(Native Method)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi
ronment.java:58)
        at 
        at java.lang.Class.forName(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:468)
        at java.awt.Cursor.<init>(Cursor.java:284)
        at java.awt.Cursor.getPredefinedCursor(Cursor.java:199)
        at java.awt.Component.<init>(Component.java:128)
        at java.awt.Container.<init>(Container.java:88)
        at java.awt.Panel.<init>(Panel.java:59)
        at java.awt.Panel.<init>(Panel.java:51)
        at java.applet.Applet.<init>(Applet.java:39)
        at AppletServer.<init>(AppletServer.java:33)
        at AppletServer.main(AppletServer.java:131)

Comments
EVALUATION I think that requested functionality is implemented by headless toolkit. Thus I close this bug (I can not close it as already implemented, so I close as not reproducible). ###@###.### 2004-11-26 05:47:55 GMT
26-11-2004

WORK AROUND Fake it or muck with JavaTest's @run applet stuff.
17-09-2004

SUGGESTED FIX Don't XOpenDisplay until it's time to realize all the widgets.
17-09-2004

PUBLIC COMMENTS new Applet() under X11 environment attempts to open connection to X11 server even when no graphics will be used.
17-09-2004