我使用了来自 here 的 Java 代码当我尝试使用 https 使用 Google 磁盘共享链接下载文件时,出现错误:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
据我了解,我必须在代码中设置:
System.setProperty("javax.net.ssl.trustStore","/usr/lib/jvm/default-java/lib/security/cacerts");
我必须将它放在代码中的什么位置,如果我稍后在 Windows PC 上运行它会怎样?
最佳答案
好的,我在 Ubuntu 18.04 上的解决方案是来自 @jsn 的这个 commnet SO question :
I ran sudo
rm /etc/ssl/certs/java/cacerts
and thensudo update-ca-certificates -f
and this fixed my issue in kubuntu 18.04.
关于Ubuntu 中的 Java 运行时错误 - 在代码中放置 javax.net.ssl.trustStore 的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50448147/