PDA

View Full Version : Trouble with jdk?



Israel
02-21-2007, 04:53 AM
Ok, I'm using Knoppix 5.1 and everytime I try to compile a source with jdk that has import javax.swing.JOptionPane; I get an error like this:



Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$000(X11Graph icsEnvironment.java:53)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEn vironment.java:142)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvir onment(GraphicsEnvironment.java:68)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:96)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at java.awt.Toolkit$2.run(Toolkit.java:821)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:80 4)
at javax.swing.UIManager.initialize(UIManager.java:12 62)
at javax.swing.UIManager.maybeInitialize(UIManager.ja va:1245)
at javax.swing.UIManager.getUI(UIManager.java:851)
at javax.swing.JOptionPane.updateUI(JOptionPane.java: 1810)
at javax.swing.JOptionPane.<init>(JOptionPane.java:1773)
at javax.swing.JOptionPane.showOptionDialog(JOptionPa ne.java:831)
at javax.swing.JOptionPane.showMessageDialog(JOptionP ane.java:645)
at javax.swing.JOptionPane.showMessageDialog(JOptionP ane.java:616)
at Welcome.main(Welcome.java:5)
root@Me:/home/Israel/Java#


Any suggestions?

kirol
02-21-2007, 10:19 AM
You appear to be attempting this while being logged as root. Do it instead under your regular account, from a konsole or xterm under X-xindows. Or at least issue "xhost +" to allow other accounts to access the display (eg root but anyone from any host, really, which is not advisable).

Israel
02-21-2007, 04:51 PM
Ah... It ran with X-terminal! Thank you!