Java Certs - PKIX path building failed
My current contract has tight network restrictions. Users need to install a certificate on their machine in order to access the internet. While developing, it appeared that Java doesn't use the OS keystore, so I needed to install it to the JDK as well. So if you see this message...
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Then try importing the certificate to the JDK with this command...
sudo keytool -import -alias myNewCertName -keystore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts -file ~/Downloads/certs/companycert.crt
On most machines the default password is "changeit".
On a Mac it might look a little more like this.
sudo keytool -import -alias myNewCertName -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/security/cacerts -file ~/Downloads/certs/companycert.crt