java can't connect to Xserver
hi need to run the following commands to debug a program
1 # Compile the java installation program 2 javac -classpath java java/Install/Install.java 3 # Execute the compiled java program 4 java -classpath java Install.Install -compile but when i am executing i take the following message akroneiro:/usr/local/JabberwockyBinary # ./install Xlib: connection to ":0.0" refused by server Xlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison) Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as th e 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 java.awt.Font.initializeFont(Font.java:308) at java.awt.Font.<init>(Font.java:344) at javax.swing.plaf.metal.DefaultMetalTheme$FontDelegate.getFont(DefaultMetalTheme.java:195) at javax.swing.plaf.metal.DefaultMetalTheme.getFont(DefaultMetalTheme.java:153) at javax.swing.plaf.metal.DefaultMetalTheme.getControlTextFont(DefaultMetalTheme.java:129) at javax.swing.plaf.metal.MetalLookAndFeel$FontActiveValue.createValue(MetalLookAndFeel.java:1399 ) at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:196) at javax.swing.UIDefaults.get(UIDefaults.java:126) at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44) at javax.swing.UIDefaults.getFont(UIDefaults.java:346) at javax.swing.UIManager.getFont(UIManager.java:491) at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:89) at javax.swing.plaf.basic.BasicLabelUI.installDefaults(BasicLabelUI.java:302) at javax.swing.plaf.basic.BasicLabelUI.installUI(BasicLabelUI.java:254) at javax.swing.JComponent.setUI(JComponent.java:449) at javax.swing.JLabel.setUI(JLabel.java:238) at javax.swing.JLabel.updateUI(JLabel.java:248) at javax.swing.JLabel.<init>(JLabel.java:141) at javax.swing.JLabel.<init>(JLabel.java:171) at Install.Install.main(Install.java:71) as you can see it can't connect as 0:0 the display has value echo $DISPLAY :0.0 What i must do? |
xhost
try (as the user you are logged in as): xhost +
This is the X perms equivalent of putting chmod 0777 on a file but should stop your Xauth failures. (A better, slightly more secure command is `xhost +local` which allows any local user to use the X display). Then run the java thing again. Presumably you are running the java program as someone other than the one you logged into your XFree86 session with? If that doesn't work, it could be some dodgy java - the line says it things :0.0 is invalid... so perhaps set it to: export DISPLAY=localhost:0.0 or export DISPLAY=akroneiro:0.0 Kev |
thx
thx for your time...
Look that only the last command seems working but still nothing akroneiro:/usr/local/JabberwockyBinary # export DISPLAY=localhost:0.0 akroneiro:/usr/local/JabberwockyBinary # xhost + Xlib: connection to "localhost:0.0" refused by server Xlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison) xhost: unable to open display "localhost:0.0" akroneiro:/usr/local/JabberwockyBinary # export DISPLAY=akroneiro:0.0 akroneiro:/usr/local/JabberwockyBinary # ./install Xlib: connection to "akroneiro:0.0" refused by server Xlib: Invalid XDM-AUTHORIZATION-1 key (failed key comparison) Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'akroneiro: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 java.awt.Font.initializeFont(Font.java:308) at java.awt.Font.<init>(Font.java:344) at javax.swing.plaf.metal.DefaultMetalTheme$FontDelegate.getFont(Default MetalTheme.java:195) at javax.swing.plaf.metal.DefaultMetalTheme.getFont(DefaultMetalTheme.ja va:153) at javax.swing.plaf.metal.DefaultMetalTheme.getControlTextFont(DefaultMe talTheme.java:129) at javax.swing.plaf.metal.MetalLookAndFeel$FontActiveValue.createValue(M etalLookAndFeel.java:1399) at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:196) at javax.swing.UIDefaults.get(UIDefaults.java:126) at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44) at javax.swing.UIDefaults.getFont(UIDefaults.java:346) at javax.swing.UIManager.getFont(UIManager.java:491) at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:89) at javax.swing.plaf.basic.BasicLabelUI.installDefaults(BasicLabelUI.java :302) at javax.swing.plaf.basic.BasicLabelUI.installUI(BasicLabelUI.java:254) at javax.swing.JComponent.setUI(JComponent.java:449) at javax.swing.JLabel.setUI(JLabel.java:238) at javax.swing.JLabel.updateUI(JLabel.java:248) at javax.swing.JLabel.<init>(JLabel.java:141) at javax.swing.JLabel.<init>(JLabel.java:171) at Install.Install.main(Install.java:71) |
thx
it works fine....!!!
The problem was that i was running the xterm as normal user and then i was entering in root mode... The problem solved when i ran the Xserver as root |
xhost +
Xlib: connection to "localhost:0.0" refused by server says you are running the xhost command NOT as the person you originally logged in as. The user that logs in controls "X11" - so if you log in as user1 and then su - user2 or something and try to run xhost as user2 you will get connection refused. Presumably you are running Debian, su - ing and then running the command? Even root under Woody can't issue that command. Run it *as the user you have logged in as - not the one about to run the java command* Kev |
use following command
debian1:/etc# grep -r "DisallowTCP" * gdm/factory-gdm.conf:DisallowTCP=true gdm/factory-gdm.conf:# at the security/DisallowTCP setting! gdm/gdm.conf:DisallowTCP=true gdm/gdm.conf:# at the security/DisallowTCP setting! grep: rc2.d/K77ntp-simple: No such file or directory grep: rc3.d/K77ntp-simple: No such file or directory X11/gdm/factory-gdm.conf:DisallowTCP=true X11/gdm/factory-gdm.conf:# at the security/DisallowTCP setting! X11/gdm/gdm.conf:DisallowTCP=true X11/gdm/gdm.conf:# at the security/DisallowTCP setting! Change all the DisallowTCP=true to false then restart x server and u can run any java gui |
All times are GMT -5. The time now is 07:50 AM. |