[英]Ubuntu Libgdx problem - No X11 DISPLAY variable was set
My problem is with X11 variable - when Im trying to launch gdx-setup.jar i get output:我的问题是 X11 变量——当我尝试启动 gdx-setup.jar 时,我得到 output:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
at java.desktop/java.awt.Window.<init>(Window.java:553)
at java.desktop/java.awt.Frame.<init>(Frame.java:428)
at java.desktop/java.awt.Frame.<init>(Frame.java:393)
at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
at com.badlogic.gdx.setup.GdxSetupUI.<init>(GdxSetupUI.java:101)
at com.badlogic.gdx.setup.GdxSetup.main(GdxSetup.java:620)
Im running ubuntu on my local laptop (NO SSH).我在本地笔记本电脑上运行 ubuntu(没有 SSH)。
System details系统详情
I've tried commands:我试过命令:
sudo apt-get update --fix-missing sudo apt-get update sudo apt-get clean sudo apt-get autoremove sudo dpkg reconfigure -a sudo apt install -f sudo apt-get update --fix-missing sudo apt-get update sudo apt-get clean sudo apt-get autoremove sudo dpkg reconfigure -a sudo apt install -f
It didnt help at all...它根本没有帮助......
When Im running AWT from intellij I can see GUI normally and there's no exception.当我从 intellij 运行 AWT 时,我可以正常看到 GUI 并且没有例外。
Ive followed there instructions while installing libgdx: https://tutorialforlinux.com/2022/11/14/step-by-step-libgdx-ubuntu-22-04-installation-guide/2/我在安装 libgdx 时遵循了那里的说明: https://tutorialforlinux.com/2022/11/14/step-by-step-libgdx-ubuntu-22-04-installation-guide/2/
echo $DISPLAY output:0回显 $DISPLAY output:0
Installed: xorg-x11安装:xorg-x11
Double clicking on jar causes with no response... Ive marked jar as executable双击 jar 导致没有响应...我已将 jar 标记为可执行文件
You can specify one of many installed java versions when running from intellij.从 intellij 运行时,您可以指定许多已安装的 java 版本之一。 When running from the command line its just a single one.I think your default java probably -actually truly is- headless.
从命令行运行时,它只有一个。我认为您的默认值 java 可能 - 实际上确实是 - 无头。 Follow this guide here to change your default command line java. I mean the error is specifically that if fails the headless check.
按照此处的指南更改您的默认命令行 java。我的意思是错误特别是如果无头检查失败。 Follow here to switch the default cmd line java version.
按照这里切换默认的cmd行java版本。
https://computingforgeeks.com/how-to-set-default-java-version-on-ubuntu-debian/ https://computingforgeeks.com/how-to-set-default-java-version-on-ubuntu-debian/
Its not unusual to have headless because thats all server side stuff needs.无头并不罕见,因为那是所有服务器端的东西所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.