Troubleshooting Aspose.Words FOSS for Java

Troubleshooting Aspose.Words FOSS for Java

These are problems that were reproduced with the published package on Java 8, 17 and 21. Each entry gives the symptom, the cause, and the fix.

Common Issues and Fixes

The compiler reports cannot find symbol for Document, DocumentBuilder, or StyleIdentifier. The com.aspose.words package is not imported, or the jar is not on the class path. Add import com.aspose.words.*; and check that the package is in your build. A program run without the jar fails with a NoClassDefFoundError for com.aspose.words.Document.

The compiler reports an unreported exception. The Document constructors and Document.save declare throws Exception. Declare it on the calling method or catch it.

Opening a file throws a FileNotFoundException. The message reads “Can’t find file” followed by the name. The path is relative to the directory the program runs in. Check the name and the working directory.

Saving or loading throws an UnsupportedOperationException whose message starts with FOSS. The format is one of the rejected ones: saving as PDF, XPS, HTML, MHTML, EPUB, RTF, DOC, ODT, WordML, PNG, SVG, or TIFF, or loading HTML, ODT, or RTF. Use DOCX, Markdown, or plain text. A rejected save to HTML, MHTML, or EPUB leaves a 0-byte file with the name you gave, so delete it. See Features and Functionalities.

A Markdown or text file starts with three unexpected bytes. Files saved by this edition in both formats start with a UTF-8 byte order mark, EF BB BF. Strip it if your reader does not expect one.

Digital signing throws an UnsupportedOperationException. DigitalSignatureUtil.sign is rejected in this edition. Signing cannot be done with it.

Frequently Asked Questions

Which Java versions were tested?

Java 8, 17 and 21.

Where can I report a problem?

On the GitHub repository of the package.

Do I need to install anything besides the package?

No. Your build tool downloads the libraries the package depends on.

See Also