Assumes your certificate is named cert.pem and is in PEM (Privacy Enhanced Mail) format
The first step converts your PEM format certificate into the DER (Distinguished Encoding Rules) format. This is a binary version of the ASCII PEM format that contains the same certificate data.
DER format certificates can be imported into a Java keystore.
openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
keytool -import -keystore keystore.jks -storepass "foobar" -file cert.der