使用 Mac OSX 自带的 JDK 1.6 进行加解密相关操作的时候,报了如下错:
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
如果你本地安装了其它 Oracle 官方的 JDK,可以先删除原来的无用 3 个软链,然后将这三个文件指向 JDK 1.7 或者 JDK 1.8 的。
cd /Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home/lib/security
rm -f cacerts trusted.libraries blacklist
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/security/cacerts cacerts
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/security/trusted.libraries trusted.libraries
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/security/blacklist blacklist