0

[root@null folder]# java -classpath bin:deps/poi.jar:deps/mysql.jar:deps/mina.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server

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.access$200(X11GraphicsEnvironment.java:65) *at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110) *at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:74) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:188) at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81) * at java.awt.Window.initGC(Window.java:467) * at java.awt.Window.init(Window.java:487) at java.awt.Window.(Window.java:536) at java.awt.Frame.(Frame.java:420) at java.awt.Frame.(Frame.java:385) * at javax.swing.JFrame.(JFrame.java:180) at server.util.ControlPanel.(ControlPanel.java:20) at server.Server.(Server.java:83)

I'm using a Terminal for this and not a GUI.

2 Answers2

1

Unfortunately, it appears you don't have a valid instance of X server running. Some libraries for Java require that one be running. From my research installing Xvfb (X Virtual Frame Buffer) is the solution to your problem. Once it is installed you will need to go to etc/profile

Then add, inside profile, these lines.

if [ -f /usr/X11R6/bin/Xvfb ]; then
/usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x16
fi

export DISPLAY=localhost:1.0

Hope this helps.

Mateusz
  • 3,038
  • 4
  • 27
  • 41
Anonymous
  • 11
  • 1
0

you might need to install Xext devel: http://rpmfind.net/linux/rpm2html/search.php?query=libXext.so.6 I can't remember exactly what is the library name for centos ... but it is something like:

yum install libXext-dev

or a variation of it (devel, xext-dev, xext-devel, libxext ... or something similar). I don't have CentOS here :(

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
  • Thanks for your quick reply! I installed it, and now i get Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.7.0_21/jre/lib/amd64/xawt/libmawt.so: libXrender.so.1: cannot open shared object file: – TheCryptKeeper May 25 '13 at 19:21
  • do the same with Xrender :) – Ferenc Deak May 25 '13 at 19:30
  • All was fixed, now i get Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. I believe it is something to do with setting a display. I'm using terminal and not a GUI to launch a server made in Java. – TheCryptKeeper May 25 '13 at 19:30
  • Yes, if you connect via a terminal, without allowing X forwarding to your host you will not have graphics. What OS are you on? – Ferenc Deak May 25 '13 at 19:35
  • Cent OS 6 is the distribution – TheCryptKeeper May 25 '13 at 19:37
  • try this: http://www.linuxquestions.org/questions/linux-server-73/java-lang-internalerror-can%27t-connect-to-x11-window-server-using-%270-0%27-as-the-value-917776/ – Ferenc Deak May 25 '13 at 19:40
  • xhost isn't a valid command on Cent OS 6 :/. someone was mentioning to me "screen". – TheCryptKeeper May 25 '13 at 19:41
  • maybe this? http://www.linuxquestions.org/questions/linux-software-2/installing-xhost-on-rh-879680/ – Ferenc Deak May 25 '13 at 19:43
  • still cannot open display :/ i'll figure it out, thanks so much for your help! – TheCryptKeeper May 25 '13 at 19:48