Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
540 views
in Technique[技术] by (71.8m points)

ubuntu - java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable

Im setting up a Forge Minecraft server which uses Java. When running the installation .jar file, it prompts me with an exception.

java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:231)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:661)
at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:162)
at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:143)

I understand that I need to set an X11 window server environment variable (for reasons unknown to me). I have tried setting the environment variable to :0.0, :10.0, :1, :1.0 yet I'm till getting the same exceptions. I am running the file on a version 20.04.1 Ubuntu Server. Any help is much appreciated.

question from:https://stackoverflow.com/questions/65921317/java-awt-awterror-cant-connect-to-x11-window-server-using-0-0-as-the-value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found the problem. I had forgotten to specify nogui at the end of the command (java -jar forge-1.12.2-35.1.37-installer.jar nogui).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...