Problem with X11 and Headless Exception

0 votes
asked May 4, 2015 in To be sorted by gzyniu (120 points)

Hi,

I'm connecting through ssh with foswiki serwer, where I want to put Your PlantUML plugin, but now I'm trying just to run .jar file with:

java -jar plantuml.jar

and I have a Headless Exception error, when I tried to use as You advised:

/usr/bin/java -Djava.awt.headless=true -jar plantuml.jar

I now have:

Exception in thread "main" java.awt.HeadlessException
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
    at java.awt.Window.<init>(Window.java:432)
    at java.awt.Frame.<init>(Frame.java:403)
    at javax.swing.JFrame.<init>(JFrame.java:202)
    at net.sourceforge.plantuml.swing.MainWindow2.<init>(Unknown Source)
    at net.sourceforge.plantuml.Run.main(Unknown Source)

What should I do in this situation? Please help :)

1 Answer

0 votes
answered May 4, 2015 by plantuml (298,440 points)

If you are connected only through SSH, you will not be able to run PlantUML in GUI mode.

You should try only in batch mode:

/usr/bin/java -Djava.awt.headless=true -jar plantuml.jar myfile.txt

commented May 4, 2015 by gzyniu (120 points)
Thank you for this answer, but I fixed the problem :)
when I was connecting through SSH, I needed to switch on the X11 server by typing -X flag. Then with headless=true it returned image.png with diagram I wanted :) but I don't know why, GUI was displayed when I ran it :) even with headless=true
...