Can't connect to X11 window server using ':0.0'

Discussion in 'Java' started by hrpreet, Apr 26, 2006.

  1. hrpreet

    hrpreet Guest

    Hi All,
    I'm trying to run a standalone application on solaris machine
    ,encountered the following problem.
    How to go about it.

    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:1
    34)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at
    java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi
    ronment.java:62)
    at sun.awt.motif.MToolkit.<clinit>(MToolkit.java:81)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at java.awt.Toolkit$2.run(Toolkit.java:748)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739)
    at java.awt.Toolkit.getEventQueue(Toolkit.java:1519)
    at java.awt.EventQueue.isDispatchThread(EventQueue.java:651)
    at
    javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:
    1238)
    at javax.swing.text.StyleContext.reclaim(StyleContext.java:419)
    at
    javax.swing.text.StyleContext.addAttribute(StyleContext.java:276)
    at
    javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:538)
    at
    javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.ja
    va:1468)
    at
    javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:12
    78)
    at
    javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:122
    6)
    at javax.swing.text.StyleContext.addStyle(StyleContext.java:88)
    at javax.swing.text.StyleContext.<init>(StyleContext.java:68)
    at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:147)
    at
    javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:
    355)
    at
    javax.swing.text.html.HTMLEditorKit.createDefaultDocument(HTMLEditorK
    it.java:186)
    at SolMetaTag.main(SolMetaTag.java:33)


    Thanks
     
    hrpreet, Apr 26, 2006
    #1
    1. Advertisements

  2. On 26 Apr 2006 10:46:08 -0700, hrpreet wrote:
    > I'm trying to run a standalone application on solaris machine
    > ,encountered the following problem. How to go about it.
    >
    > Exception in thread "main" java.lang.InternalError: Can't connect to
    > X11 window server using ':0.0' as the value of the DISPLAY variable.


    This really isn't a Java issue. The error message means that the
    application tried to connect to the X server (i.e. the display), but
    one of the following prevented it:

    - you are not running an X server on your solaris box, but your
    DISPLAY variable ":0.0" is telling the application that you are.

    - you are running an X server (maybe on another machine), but ":0.0"
    is not the correct DISPLAY value, so the application fails to
    connect to the server.

    - there is an X server running and the DISPLAY variable is correct,
    however you are not authorized to connect to the server, either
    because it is owned by another user or because you have not
    configured your environment correctly.

    If you don't think the program actually needs a GUI, you can specify
    the following when you run the application:

    -Djava.awt.headless=true

    See also:

    http://java.sun.com/j2se/1.5.0/docs/guide/awt/AWTChanges.html#headless

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Apr 26, 2006
    #2
    1. Advertisements

  3. hrpreet

    Morten Alver Guest

    Gordon Beaton wrote:
    > On 26 Apr 2006 10:46:08 -0700, hrpreet wrote:
    >
    >>I'm trying to run a standalone application on solaris machine
    >>,encountered the following problem. How to go about it.
    >>
    >>Exception in thread "main" java.lang.InternalError: Can't connect to
    >>X11 window server using ':0.0' as the value of the DISPLAY variable.

    >
    >
    > This really isn't a Java issue. The error message means that the
    > application tried to connect to the X server (i.e. the display), but
    > one of the following prevented it:
    > (...)
    > - there is an X server running and the DISPLAY variable is correct,
    > however you are not authorized to connect to the server, either
    > because it is owned by another user or because you have not
    > configured your environment correctly.


    I've typically run into this (on Linux) when trying to run a graphical
    application as root. Many Linux distros are by default set up to
    disallow the root user from accessing the X server; perhaps the same is
    true for Solaris.


    --

    Morten
     
    Morten Alver, Apr 27, 2006
    #3
  4. On Thu, 27 Apr 2006 11:42:31 +0200, Morten Alver wrote:
    > I've typically run into this (on Linux) when trying to run a
    > graphical application as root. Many Linux distros are by default set
    > up to disallow the root user from accessing the X server; perhaps
    > the same is true for Solaris.


    Of course, because X authorization doesn't know who is trying to
    connect (it's just a socket connection), so there's no way to give
    special privileges to root.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Apr 27, 2006
    #4
  5. hrpreet

    rajee p

    Joined:
    Mar 18, 2016
    Messages:
    1
    Likes Received:
    0
    Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method).
    Running the application in solaris 10 server. Have tried all these things - java -Djava.awt.headless=true
    export DISPLAY=localhost:0.0
    tried DISPLAY=:0.0,DISPLAY=:0. but i am getting this exception. Pls help
     
    rajee p, Mar 18, 2016
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.