DCP-o-matic 2.15.x has an XML export feature. Generating an Interop DCP from an MXF source file will also create an XML subtitle file. While the export function is not scriptable, I guess creation and interop generation should be doable with the existing commandline options. This would create unnecessary video and audio asset files, but, who cares, would be easy to delete them within a script after XML creation.
I guess there is something in ASDCP already to do that, and I also think some of Carls libraries dealing with subs would be able to do it.
However, not immediately javaish.
Have you an idea, if the asdcp-unwrap is compatible with all Linux distributions (Debian, Ubuntu (desktop), Linux Mint, Red Hat Enterprise Linux, Fedora (workstation), CentOS, OpenSUSE Leap, Arch Linux, ...)