How to disable 'headless java mode' to be able to run .jre GUI application using command line on Ubuntu

205 views Asked by At

I have problem with running my java GUI program using cmd on Ubuntu Linux. When I run it using IntelliJ it works just fine, but using cmd breaks it.

From my research I have understood that the problem might be caused by me downloading the 'headless java version'. So I d like to ask how can I solve this problem. How to mby reinstall it correctly or something that would help.

Thx a lot

I tried:

java -jar TIcTacToe.jar

But, outcome is:

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 TicTacToe.<init>(TicTacToe.java:7)
    at Main.main(Main.java:3)

I am expecting to be able to run my .jre file using cmd.

0

There are 0 answers