Ubuntu14.04,openjdk8 cacerts的丢失

在Ubuntu14.04下使用InstallCert.java安装证书时报错:

Loading KeyStore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts...
Exception in thread "main" java.io.FileNotFoundException: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at InstallCert.main(InstallCert.java:81)

查看/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security目录:

root@ubuntu:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security# ls -lh
total 8.0K
lrwxrwxrwx 1 root root  46 Jul 26 20:45 blacklisted.certs -> /etc/java-8-openjdk/security/blacklis
lrwxrwxrwx 1 root root  27 Jul 26 20:45 cacerts -> /etc/ssl/certs/java/cacerts
lrwxrwxrwx 1 root root  40 Jul 26 20:45 java.policy -> /etc/java-8-openjdk/security/java.policy
lrwxrwxrwx 1 root root  42 Jul 26 20:45 java.security -> /etc/java-8-openjdk/security/java.securit
-rw-r--r-- 1 root root 639 Jul 26 19:54 local_policy.jar
lrwxrwxrwx 1 root root  36 Jul 26 20:45 nss.cfg -> /etc/java-8-openjdk/security/nss.cfg
-rw-r--r-- 1 root root 621 Jul 26 19:54 US_export_policy.jar

发现cacerts是一个相当于windows下的快捷方式

在Stack Overflow找到了这个相关的问题

This is due to a bug already reported here: Ubuntu bug ticket
The ticket above links another similar issue, which provides a workaround:

$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java

执行完上面两条命令后又查看了一下证书所在的目录:

root@ubuntu:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security# ls -lh
total 8.0K
lrwxrwxrwx 1 root root  46 Jul 26 20:45 blacklisted.certs -> /etc/java-8-openjdk/security/blacklisted.certs
lrwxrwxrwx 1 root root  27 Jul 26 20:45 cacerts -> /etc/ssl/certs/java/cacerts
lrwxrwxrwx 1 root root  40 Jul 26 20:45 java.policy -> /etc/java-8-openjdk/security/java.policy
lrwxrwxrwx 1 root root  42 Jul 26 20:45 java.security -> /etc/java-8-openjdk/security/java.security
-rw-r--r-- 1 root root 639 Jul 26 19:54 local_policy.jar
lrwxrwxrwx 1 root root  36 Jul 26 20:45 nss.cfg -> /etc/java-8-openjdk/security/nss.cfg
-rw-r--r-- 1 root root 621 Jul 26 19:54 US_export_policy.jar

好像没变化。

再执行InstallCert.java安装证书,不报错了,表示成功了。

Stack Overflow原帖地址:https://stackoverflow.com/questions/33439905/is-the-cacerts-file-missing-in-ubuntu-15-10-and-openjdk-8-jdk

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值