我正在尝试通过 Putty 运行一个 jar 文件,该文件是通过 Amazon Web Server 上传的。我尝试将编译器合规级别从 1.8 更改为 1.7。我得到错误:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at java.awt.Frame.<init>(Frame.java:385)
at javax.swing.JFrame.<init>(JFrame.java:174)
at Smiley.<init>(Smiley.java:10)
at Main.main(Main.java:5)
当我从桌面运行 jar 文件时,它工作正常。