• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jasper Report: Can't connect to X11 window server

 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The application is developed and deployed on windows machine and working like champ. But now I deployed the app on linux server (Kernel version: 2.4.21-20.ELsmp GNU/Linux) and facing this error.

Anybody help please. Thanks.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need to run the JVM in headless mode if you want to use any of the AWT or Swing components.
[ March 17, 2005: Message edited by: Ben Souther ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying it out.
Thanks Ben.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any Luck?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. Actually haven't tried it out, my project manager changed the priorities and assigned me some other work. Will return to this, may be after a week.

Thanks.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding the -Djava.awt.headless=true to my JVM solved the problem for me.

Thanks a lot.

Jeff
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But I still get an Exception:

java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.ja va:62)

Save me!!!
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adeel,
In the .profile add this statement "DISPLAY=:0.0"
Then execute the .profile and try again. This is what I did and the issue got resolved. Also make sure you have the X11 package installed in linux.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sripathi Krishnamurthy:
In the .profile add this statement "DISPLAY=:0.0"
Then execute the .profile and try again. This is what I did and the issue got resolved. Also make sure you have the X11 package installed in linux.



Pardon me, Sripathy.
Could you please explain .profile a bit?
Dont know about X11 package. Is it same as XFree86??

[Edited]
Oh! I forgot to thank you.
Thanks mate.
[ April 18, 2005: Message edited by: Adeel Ansari ]
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:


Pardon me, Sripathy.
Could you please explain .profile a bit?
Dont know about X11 package. Is it same as XFree86??

[Edited]
Oh! I forgot to thank you.
Thanks mate.

[ April 18, 2005: Message edited by: Adeel Ansari ]



I am not an unix expert. But I can try my best to explain what .profile means. Whenever you login to unix, you will reach your home directory. It can be /home/adeel. You can give "cd ~" in unix which will take you to your home directory. In this directory you can create(if one does not exist) a file called .profile . you can give a set of commands in this .profile . Whenever you login, the commands of the .profile will be executed. So it is like first time initialization of all the required commands can be dumped in .profile. You have to give execute permission for .profile to be executed.

A sample .profile can be like,

#-----------------------------------------------#
# A sample .profile file #
#-----------------------------------------------#
# Courtesy of Developer's Daily #
# http://www.DevDaily.com #
#-----------------------------------------------#

PATH=$PATH:/usr/local/bin:/usr/gnu/bin:.

set -o vi # enable the ability to recall previous commands with

PS1='$PWD> ' # set the prompt to display the current directory

#----------------------------#
# a few Korn shell aliases #
#----------------------------#

alias nu="who|wc -l" # nu - number of users
alias np="ps -ef|wc -l" # np - number of processes running
alias p="ps -ef"

# mimick a few DOS commands with these aliases:

alias cd..="cd ../.."
alias cd...="cd ../../.."
alias dir="ls -al"
alias edit=vi
alias help=man
alias path="echo $PATH"

X11, also known as x-windows is needed to view graphic images and windows. I am not sure if x-windows and xfree86 are same.

Hope this helps.
Thanks and cheers
Sripathi
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the first line of my first post on this topic which was

"java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable."

As Sripathy said about setting DISPLAY:0.0 into .profile, this error message is already addressing the same problem. I figured out that X-windows is not there. What you people say?

Thanks Sripathy for your efforts.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi adeel,

last night I had posted on this thread but thread is lost due to saloon's dis crash !!
I dont have too much idea of your problem but I was wondering if still you have tried Ben's suggestion of running JVM in headless mode.
because "Can't connect to X11 window server" error may be due if you are not running in headless mode or It may be one reason as you said in one of post that might be threr is no X11 server. I have found this on net.



What causes the error "Can't connect to X11 window server"?
The Sun AWT classes on Unix and Linux have a dependence on the X Window System: when you use the classes, they expect to load X client libraries and be able to talk to an X display server. This makes sense if your client has a GUI... unfortunately, it's required even if your client uses AWT but does not have a GUI. For example, you need access to an X server to use the java.awt.BufferedImage class.

Access to an X display server means a few things:

* An X display server is running somewhere.
* The environment in which you run Java includes an environment variable DISPLAY identifying how to reach the server.
* There are no security settings in the server to prevent your client from opening a connection.

In general, if you're running your program from a terminal within the X Window System, all these things are true and the program just works. If you can run other X applications, like xterm or xclock, you should be able to run your Java AWT application.

In non-graphical environments, such as a servlet engine, your program may not know how to find or connect to an X display server. A common solution here is to run a special non-display version of the X display server, Xvfb, and set DISPLAY to point to it.

New information for JDK1.4: JDK1.4 evidently includes a new property that will allow the AWT to run in a headless (without a display) environment. This setting is supposed to solve the problem: java.awt.headless=true

 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic