We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with FileFormatType.HTML or FileFormatType.PDF

Hello,

I was trying to save simple workbook with different FileFormatType using command line in linux environment. For the testing I have downloaded the latest version of Aspose.Cells for Java for JDK 1.4. Attached source code is based on original JDK 1.4/samples/consoleDemo/Northwind/ConsoleDemo.java

Here is java version I'm using:

java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

Unfortunately when FileFormatType.HTML or FileFormatType.PDF is used, then I'm getting the following error:

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.Font.initializeFont(Font.java:308)
at java.awt.Font.(Font.java:344)
at javax.swing.plaf.metal.DefaultMetalTheme$FontDelegate.getFont(DefaultMetalTheme.java:195)
at javax.swing.plaf.metal.DefaultMetalTheme.getFont(DefaultMetalTheme.java:153)
at javax.swing.plaf.metal.DefaultMetalTheme.getControlTextFont(DefaultMetalTheme.java:129)
at javax.swing.plaf.metal.MetalLookAndFeel$FontActiveValue.createValue(MetalLookAndFeel.java:1399)
at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:199)
at javax.swing.UIDefaults.get(UIDefaults.java:129)
at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:44)
at javax.swing.UIDefaults.getFont(UIDefaults.java:349)
at javax.swing.UIManager.getFont(UIManager.java:491)
at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:89)
at javax.swing.plaf.basic.BasicLabelUI.installDefaults(BasicLabelUI.java:302)
at javax.swing.plaf.basic.BasicLabelUI.installUI(BasicLabelUI.java:254)
at javax.swing.JComponent.setUI(JComponent.java:449)
at javax.swing.JLabel.setUI(JLabel.java:238)
at javax.swing.JLabel.updateUI(JLabel.java:248)
at javax.swing.JLabel.(JLabel.java:141)
at javax.swing.JLabel.(JLabel.java:212)
at com.aspose.cells.bJ.(Unknown Source)
at com.aspose.cells.er.(Unknown Source)
at com.aspose.cells.kD.a(Unknown Source)
at com.aspose.cells.iG.c(Unknown Source)
at com.aspose.cells.iG.b(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at ConsoleTest.createStockChart(ConsoleTest.java:118)
at ConsoleTest.main(ConsoleTest.java:38)

Hi,

Please note down, Aspose.Cells for Java also depends on few additional java libraries. Please download them from the links given below.

Add them in your class path and then see if it resolves your problem. Let us know if your problem does not go away and you have any other question.

Download Links:

  1. Aspose.Cells for Java v2.5.4.12
  2. Additional Libraries

Hi,

Please try following JVM option when running your application:

java … -Djava.awt.headless=true …

Thanks a lot for the last recomendation. JVM option java.awt.headless=true is fixing issue I have reported.