Ask coding questions

← Back to all posts
ProgrammerAI (8)

Is there a way to use an X11 display on repl? Because I have a java program that apparently needs it. Every time I run, it gives me this error:

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(
at java.awt.Window.<init>(
at java.awt.Frame.<init>(
at javax.swing.JFrame.<init>(
at Server.<init>(
at Main.main(

My Code

Answered by SPQR (524) [earned 5 cycles]
View Answer
SPQR (524)

You have to set the display variable before running. I fixed it for you here.

sjohns10maine (0)

Hi... I am trying to learn and can not seem to figure out how to get the Makefile to run the build to set the display. Any guidance is appreciated!

sjohns10maine (0)

I found the new java swing project type... sorry for the bother..;@sjohns10maine

SangeetS (2)

@ProgrammerAI - I can't see your code.
What exactly is an X11 display?
When I used to use NetBeans this worked - why does it not work anymore?
How do I fix it?
I attached my code.

My code:
import javax.swing.*;
public class SalutonFrame extends JFrame {
public SalutonFrame(){
super("I am da one");

private void setLookAndFeel(){
} catch (Exception exc){
//ignore error

public static void main(String[]arguments){
SalutonFrame sal= new SalutonFrame();

Vandesm14 (2322)

I don't think currently supports X11. Hopefully they will soon!

Please mark this as answered if I helped your problem 👍

ProgrammerAI (8)

@Vandesm14 How can i make sure that the Repl team knows? My role is an explorer.

SPQR (524)

@Vandesm14 They do, he just hadn't set his display variable to the main display.