Can't connect to X11 Server

Hello,

I just downloaded Aspose.PowerPoint for Java version 1.4.1.0. When I ran it for the first time, this error message appeared:

Exception in thread "main" 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.(X11GraphicsEnvironment.java:134)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
at com.aspose.powerpoint.eh.(SourceFile:55)
at com.aspose.powerpoint.TextFrame.else(SourceFile:691)
at com.aspose.powerpoint.Shape.new(SourceFile:844)
at com.aspose.powerpoint.Rectangle.new(SourceFile:384)
at com.aspose.powerpoint.Shape.byte(SourceFile:979)
at com.aspose.powerpoint.Presentation.case(SourceFile:2819)
at com.aspose.powerpoint.Presentation.write(SourceFile:672)
at com.ge.epcm.PPT.savePresentation(PPT.java:97)
at com.ge.epcm.PresentationCreator.processPPTDocument(PresentationCreator.java:567)
at com.ge.epcm.PresentationCreator.processRequest(PresentationCreator.java:192)
at com.ge.epcm.PresentationCreator.createPowerPoint(PresentationCreator.java:140)
at com.ge.epcm.PresentationCreator.(PresentationCreator.java:125)
at com.ge.epcm.PresentationCreator.main(PresentationCreator.java:51)
^C204 bsed23:ePCM $

Notice that the exception occured during a call to Presentation.write, which is the last call my application makes to Aspose.PowerPoint.

When I unset DISPLAY or set it to something silly like "foo.bar:347.7765" it failed in the same way. However when I set to an actual X-Server running on my client system, it seemed to work ok, but I didn't see anything display. Should I have seen something?

Regardless, this is *not* an acceptable solution though because the Aspose.PowerPoint application is running on a server and it will not have an X-Server running.

Why does Aspose.PowerPoint need an X-Server?

Thank you,
Randy Stegbauer

Dear Randy,



Apose.PowerPoint works with graphics.

It uses Graphics2D and JAI to load and save images, read textures,

dynamically create fill patterns and calculate bounds of rendered text.

Alexey,

Thank you for the response.

What does Aspose.PowerPoint do if there is no X11 Server running on the system?

I have used JAI to convert images without X11. What features of Aspose.PowerPoint would I be giving up if I don't run an X11 Server?

Thank you,
Randy Stegbauer

In your case exception was thrown on m_graphics initialization:



m_image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);

m_graphics = m_image.createGraphics();

Alexey,

After digging through the Javadoc and source code for the GraphicsEnvironment class, I discovered the system property "java.awt.headless".

Setting this to true solves my problem.

Thank you,
Randy Stegbauer

Hi.

Does Aspose.Words (java package) has the same limitation? E.g. does Aspose.Words needs X-Server?

Thanks
Leon

Hi Leon,

Thanks for your request. Aspose.Words for Java does not have any external dependencies. So there is not such limitation in Aspose.Words for Java. Please see the following link to learn about system requirements of Aspose.Words for Java:

Best regards,

Hi Alexey

Thank you for quick response.

Unfortunately, I receive the next error, while trying to save document as HTML:

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>HE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Messages:
Could not initialize class sun.awt.X11GraphicsEnvironment;

<span style=“font-size: 9pt; font-family: “Verdana”,“sans-serif”; color: black;”>Stack Trace:

java.lang.NoClassDefFoundError: Could not initialize class
sun.awt.X11GraphicsEnvironment

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)

at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)

at asposewobfuscated.ja.a(ImageUtil.java:1794)

at com.aspose.words.r.S(ImageTransform.java:73)

at com.aspose.words.ky.a(ImageWriter.java:374)

at com.aspose.words.ky.a(ImageWriter.java:127)

at com.aspose.words.ve.w(HtmlWriter.java:845)

at com.aspose.words.ve.visitShapeStart(HtmlWriter.java:789)

at com.aspose.words.Shape.accept(Shape.java:98)

at com.aspose.words.CompositeNode.acceptChildren(CompositeNode.java:782)

at com.aspose.words.Paragraph.accept(Paragraph.java:335)

at com.aspose.words.CompositeNode.acceptChildren(CompositeNode.java:782)

at com.aspose.words.Body.accept(Body.java:69)

at com.aspose.words.ve.a(HtmlWriter.java:292)

at com.aspose.words.ve.a(HtmlWriter.java:280)

at com.aspose.words.ve.b(HtmlWriter.java:263)

at com.aspose.words.ve.writeBody(HtmlWriter.java:202)

at com.aspose.words.ve.xW(HtmlWriter.java:140)

at com.aspose.words.ve.a(HtmlWriter.java:56)

at com.aspose.words.ve.a(HtmlWriter.java:29)

at com.aspose.words.Document.a(Document.java:1494)

at com.aspose.words.Document.save(Document.java:925)

at com.aspose.words.Document.save(Document.java:881)

at
my code …

My code looks like this:

Document doc = new Document(inputStream);

File out = new File(path + name + “.html”);
doc.save(out.getAbsolutePath());

// inputStream points on a file with extension *.doc or *.docx


Please assist.

Thanks
Leon