We got error "Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable." when calling aspose.pdf.Pdf.save under autosys job

We have used aspose.pdf.Pdf.save() function to save the xml to PDF. The program is running under regular command under Unix window is ok. However when running under autosys job, we got th following error, seems like related to X11 window. Please help check what is the issue.

stty: standard input: Inappropriate ioctl for device
Exception in thread "Main Thread" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
at sun.awt.X11.XToolkit.(XToolkit.java:89)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.awt.Toolkit$2.run(Toolkit.java:836)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:828)
at aspose.pdf.figure.Abn.(SourceFile:34)
at aspose.pdf.figure.Abi.a(SourceFile:99)
at aspose.pdf.figure.Aba.a(SourceFile:151)
at aspose.pdf.figure.Aba.a(SourceFile:96)
at aspose.pdf.xml.Abh.a(SourceFile:226)
at aspose.pdf.xml.Abh.a(SourceFile:632)
at aspose.pdf.xml.Abi.a(SourceFile:577)
at aspose.pdf.xml.Acc.a(SourceFile:796)
at aspose.pdf.xml.Aar.a(SourceFile:97)
at aspose.pdf.xml.Aba.a(SourceFile:112)
at aspose.pdf.Pdf.save(SourceFile:1166)
at aspose.pdf.Pdf.save(SourceFile:1112)
at gds.Import.GenerateLetter.getMailingLetterPDFfromXml(GenerateLetter.java:954)
at gds.Import.GenerateLetter.processWelcomePackages(GenerateLetter.java:652)
at gds.Import.GenerateLetter.processLetter(GenerateLetter.java:203)
at gds.Import.GenerateLetter.main(GenerateLetter.java:127)

Hello Joanna,


Thanks for using our products.

We are testing this scenario at our end and will share our findings shortly. We apologize for your inconvenience.

Is there any update on this?

Hello Joanna,


Thanks for your patience.

This problem seems more specific to the fact that you are not specified the value of DISPLAY variable when working on Unix shell. May be your autosys job is trying to display some window/dialog and hence the value of DISPLAY variable is not properly set to your local system, you encountered this issue.

You may consider running the following command on Unix shell under Bash mode.

[root@mysystem]export DISPLAY=localhost:0.0

You may consider visit the following link for further information on similar topics.

I am not entirely certain that either you have tried above specified/followed commands/instructions, but just in case, I wanted to share this information. For further investigation, I have also logged this problem as PDFJAVA-33134 in our issue tracking system. We are really sorry for your inconvenience.

If you haven’t resolved the issue yet, here is the solution. In your java command add the following option -Djava.awt.headless=true

Hi Raja,


Thanks for sharing the information. We will further test the scenario using this command and will share our findings. Once again, we really appreciate your cooperation in this regard.