Search code examples
java-11java-17docx4j

What version of docx4j is required for jdk11 and jdk17?


I am still using older version of docx4j (2.8.1.10) which is causing slowness in font mapping and hash. While I have migrated to jdk11 and will shortly be moving to jdk17.

Haven't tried anything yet and would like to know how to proceed.


Solution

  • As per https://www.docx4java.org/downloads.html use 11.5 (or 11.4) series, which work under Java 11 and later.

    Note: docx4j v11.5 uses Jakarta XML Binding API 4 .0 (and v11.4 uses Jakarta XML Binding API 3.0), as opposed to JAXB 2.x used in earlier versions (which import javax.xml.bind.*).

    Since v11.4 and v11.5 uses jakarta.xml.bind, rather than javax.xml.bind, if you have existing code which imports javax.xml.bind, you'll need to search/replace across your code base, replacing javax.xml.bind with jakarta.xml.bind.

    You'll also need to replace your JAXB jars (which Maven will do for you automatically; otherwise get them from the relevant zip file).