我即将更新/添加 Java 证书到 MacOS 中的证书列表。
为了知道要添加到哪个“cacerts”文件 - 运行以下命令:
sudo find / -iname "*cacerts*" 2> /dev/null
这是结果:
/Applications/DataGrip.app/Contents/jdk/Contents/Home/jre/lib/security/cacerts
/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home/jre/lib/security/cacerts
/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/lib/security/cacerts
/Applications/NetBeans/glassfish-4.1.1/glassfish/domains/domain1/config/cacerts.jks
/Applications/zoom.us.app/Contents/Resources/zcacert.pem
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/cacerts
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home/jre/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/security/cacerts
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/security/cacerts
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/excon-0.54.0/data/cacert.pem
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/cacerts.pem
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/cacert.pem
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.3/lib/httpclient/cacert1024.pem
/opt/chefdk/embedded/ssl/certs/cacert.pem
/opt/chefdk/LICENSES/cacerts-README.md
/opt/vagrant/embedded/cacert.pem
/opt/vagrant/embedded/gems/gems/httpclient-2.8.3/lib/httpclient/cacert.pem
/opt/vagrant/embedded/gems/gems/httpclient-2.8.3/lib/httpclient/cacert1024.pem
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/pycacert.pem
/System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts
/System/Library/Java/Support/Deploy.bundle/Contents/Home/lib/security/cacerts
/Users/user1/java/certificates/add_capitalone_cacert.sh
/Users/user1/java/certificates/cacerts
/Users/user1/Library/Caches/IdeaIC2017.1/tasks/cacerts
/Users/user1/Library/Caches/IdeaIC2017.2/tasks/cacerts
/Users/user1/Library/VirtualBox/vbox-ssl-cacertificate.crt
如何知道我应该添加到哪一个?
(我正在使用InteliJ IDE进行开发,但不确定该路径
/Applications/IntelliJ IDEA.app/...
是否应该用于存储)
在 Intellij IDE 中编写一个简单的测试类来打印它正在使用的版本。用它来打印路径...
System.out.println(System.getProperty("java.home"));
这取决于 Intellij 使用哪个 JDK/JRE。 cacerts 文件通常位于 JAVA_HOME/jre/lib/security 下。我们更新此商店以获取内部签名的证书。
您可以在
File > Project Structure
和 File > New Projects Setup > Structure
中识别项目的 Java 运行时。请注意,这与 IDE 本身运行的“启动 Java 运行时”不同。可以在 About
对话框或 IDE
配置文件中找到。 MacOS 上的 IntelliJ IDEA 使用自己捆绑的 JDK。 此外,当您在 IDE 之外运行应用程序时,您还应该在
echo $JAVA_HOME
指向的位置更新 cacerts。