LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-27-2004, 06:39 AM   #1
paragvd
LQ Newbie
 
Registered: Apr 2004
Location: India
Posts: 1

Rep: Reputation: 0
Question 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

Last edited by paragvd; 04-27-2004 at 06:54 AM.
 
Old 04-27-2004, 08:35 AM   #2
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
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.
 
Old 04-27-2004, 06:41 PM   #3
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
You will need to make a /etc/X0.hosts file to make the 'xhost' permanent.
 
Old 08-26-2004, 04:01 AM   #4
gatito
LQ Newbie
 
Registered: Aug 2004
Distribution: debian, suse
Posts: 2

Rep: Reputation: 0
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.
 
Old 10-05-2004, 04:35 AM   #5
malamut
LQ Newbie
 
Registered: Oct 2004
Posts: 1

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot connect to X11 window server using ":).0" as DISPLAY variable cclack Linux - Newbie 4 09-06-2007 10:32 PM
Starting Java from shell script (Exception in thread "main") rolf_mueller Linux - Software 5 10-30-2004 03:11 AM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 04:47 AM
Exception in thread "main" java.lang.NoClassDefFoundError: Lobais Linux - Software 19 06-23-2004 09:42 AM
Exception in thread "main" java.lang.NoClassDefFoundError: melinda_sayang Programming 2 04-27-2004 12:49 PM


All times are GMT -5. The time now is 03:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration