You can do it with code, or if you ship your app with Conveyor (disclosure: my product) you can do it at packaging time. The latter is simple and works with any SSL stack transparently
https://conveyor.hydraulic.dev/14.3/configs/jvm/#appjvmadditional-ca-certs
but if you don't want to use that then you'll have to configure the java ssl stack yourself (or switch to a different http stack like okhttp that also supports this)