LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Exception in thread "main" java.lang.InternalError: Can't connect to X11 window serve (https://www.linuxquestions.org/questions/programming-9/exception-in-thread-main-java-lang-internalerror-cant-connect-to-x11-window-serve-175034/)

paragvd 04-27-2004 05:39 AM

Exception in thread "main" java.lang.InternalError: Can't connect to X11 window serve
 
Hello Friends,

I dont know whether this would be the correct forum or not but my problem is very critical so please help me.

1. I am working on linux server where I have installed Tomcat4.x, Apache 2.0, JDK1.4.2. I have set all CLASSPATH.
Java is working fine. I am using one JCLASS component which is useful in chart creation.

3. Few days back the code regarding Frame cration was working fine but now its giving an error. I am actually running these files using cron and my requirement is also same.

4. I have tried almost all possibilities like

export DISPLAY=localhost:0.0
export DISPLAY=ipaddress:0.0, but no luck.

Can you explain me what could be the reason.


JAVA ERROR:

"
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:134)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.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.invokeLater(EventQueue.java:792)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1170)
at FrameDemo.main(FrameDemo.java:35)

"

Please let me know your suggestions as soon aspossible
Parag

Looking_Lost 04-27-2004 07:35 AM

Is it being run as a different user from the one who is currently logged in? If so you may have to incorporate

xhost + localhost

somewhere along the line, I can't try it out at the moment though, running a java gui program from a cron job.

aaa 04-27-2004 05:41 PM

You will need to make a /etc/X0.hosts file to make the 'xhost' permanent.

gatito 08-26-2004 03:01 AM

hi
maybe some of you can help me with this:
i know that you have to be logged in as the user who wants to run some gui from the console (after doing that xhost + user or xhost + localhost)
this works fine but if i want to run this scripts with cron, i get errors (cant connect to x server and so on)
but it works fine if i do this by hand
thanx in advance.

malamut 10-05-2004 03:35 AM

I had the same problem but found an easy solution elsewhere: use
Quote:

java -Djava.awt.headless=true ...
to start your software. This will work in Java 1.4 and higher (at least in Sun's own Java, I don't know about other JVM's).

This parameter will make it impossible to actually display anything on a screen, but all the awt stuff which does not really need a screen will work.


All times are GMT -5. The time now is 11:42 PM.