What does "no X11 display variable was set, but this program performs an operation which requires it" error mean and how/can I fix it?

时间:2015-07-29 00:14:50

标签: java

Here is a link to the project I am working on: http://goo.gl/myzeQQ It works fine when I run it in Netbeans on my desktop(java 8) but gives me this error when I run it at the link above. It looks like the error might be due to the online compiler not being compatible with the JFrame graphics in some way.

1 个答案:

答案 0 :(得分:3)

It's because your code is running in a headless environment (no GUI) yet you are creating and using a GUI.

It works fine on your computer because you have a GUI and everything required to display those graphical components.

You can fix/prevent this by creating a program that runs in the terminal and only accepts text input, or installing some sort of virtual gui on the machine that runs it.

相关问题