Encoding/Decoding in Java 9 using javax.xml.bind or not

DatatypeConverter and Java 9

If you used to do conversions, like

import javax.xml.bind.DatatypeConverter;

byte[] bin = DatatypeConverter.parseHexBinary("0769cc");

With Java 9 you will get errors, since javax.xml.bind is no longer in the module path, it is considered part of Java Enterprise. With Java 10 it may even be removed from the JRE.

It is a known problem:

There are many solutions: Rewriting the function or Using command line option to load the library at runtime ...  But the most robust and long term one seems to be adding the dependency to your project.

Here I will focus on adding the dependency:

Java Enterprise library 

As a Maven dependency:

Directly in IntelliJ (Community edition):


Guava also provides conversion methods, but you will have to adapt your code:

Apache Common

Same for Apache Commons. It is a matter of taste.


No comments:

Sound banks

"Conserve the sound" http://www.conservethesound.de/  online museum for vanishing and endangered sounds. The sound of a dial tel...