我在 ImageJ 中编写了一个宏来在 JPEG 图像文件列表上运行“测量”。我正在使用 headless.jar 以无头模式在远程 linux 机器上运行代码。
我得到以下异常 -
> java.awt.HeadlessException: No X11 DISPLAY variable was set, but this
> program performed an operation which requires it.
> at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
> at java.awt.Window.<init>(Window.java:433)
> at java.awt.Frame.<init>(Frame.java:403)
> at ij.plugin.frame.PlugInFrame.<init>(PlugInFrame.java:13)
> at ij.plugin.frame.Editor.<init>(Editor.java:89)
> at ij.plugin.frame.Editor.<init>(Editor.java:85)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at ij.IJ.runPlugIn(IJ.java:156)
> at ij.IJ.runPlugIn(IJ.java:141)
> at ij.io.Opener.open(Opener.java:172)
> at ij.IJ.open(IJ.java:1505)
> at ij.macro.Functions.open(Functions.java:2325)
> at ij.macro.Functions.doFunction(Functions.java:141)
我该如何覆盖这个?有没有办法阻止 ImageJ 打开图形环境?