Hello, I’d like to use the processing core library, however, I don’t actually want to use the processing window or draw
function at all. I’m using processing because the PImage
class and some other utilities are very useful, but this is a console application and I don’t need any of the other features. I’ve got a class that extends PApplet
, and its constructor calls sketchPath()
and passes the path of the current running jar so that I can call loadImage()
without calling setup()
so a window doesn’t have to be created. This works almost perfectly, however, I’m encounter issues when running headless on Linux server, and I understand why, I just don’t know what to change to disable all the display type stuff. This is the error:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using '0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:232)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:286)
at processing.core.PApplet.loadImage(PApplet.java:5564)
at processing.core.PApplet.loadImage(PApplet.java:5480)
at ImgDiff.<init>(ImgDiff.kt:9)
at ImgDiffKt.main(ImgDiff.kt:31)