c:\Windows\System32\java.exe 默认证书存储位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6130020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
c:\Windows\System32\java.exe default cert store location?
提问by Jus12
I have not set java_home
and I need to know where the c:\Windows\System32\java.exe
file points to.
I have several JDKs and JREs on my system.
我还没有设置java_home
,我需要知道c:\Windows\System32\java.exe
文件指向哪里。我的系统上有几个 JDK 和 JRE。
The reason is that I am trying to connect via SSL to some server and it works in Netbeans after I export the certificate in the appropriate JRE (which I can see via Netbeans options)
原因是我试图通过 SSL 连接到某个服务器,并且在我将证书导出到适当的 JRE 后它可以在 Netbeans 中工作(我可以通过 Netbeans 选项看到)
However, when I connect via command-line, I get an SSL error. I tried adding the certificate to all my JREs but I cannot get it to work. I think it is a problem that this Windows shortcut points to some place I overlooked.
但是,当我通过命令行连接时,出现 SSL 错误。我尝试将证书添加到我所有的 JRE,但我无法让它工作。我认为这个 Windows 快捷方式指向我忽略的某个地方是一个问题。
Is there an easy way to find out which JRE is the default one?
有没有一种简单的方法可以找出哪个 JRE 是默认的?
[EDIT] Or rather I need to find the location of the default keystore in the default JRE.
[编辑] 或者更确切地说,我需要在默认 JRE 中找到默认密钥库的位置。
[EDIT] My problem is elaborated below:
[编辑]我的问题详述如下:
the following two give SSL error:
以下两个给出 SSL 错误:
"c:\Program Files\Java\jre6\bin\java.exe" -cp myjar.jar mypackage.myclass
"c:\Program Files (x86)\Java\jre6\bin\java.exe" -cp myjar.jar mypackage.myclass
The following two work
下面两个工作
"c:\Program Files\Java\jdk1.6.0_24\bin\bin\java.exe" -cp myjar.jar mypackage.myclass
"c:\Program Files (x86)\jdk1.6.0_24\bin\jre6\bin\java.exe" -cp myjar.jar mypackage.myclass
I have exported the certificate using all four commands:
我已经使用所有四个命令导出了证书:
"c:\Program Files\Java\jdk1.6.0_24\bin\bin\keytool.exe" -import -alias myalias -file mycertfile
"c:\Program Files (x86)\Java\jdk1.6.0_24\bin\bin\keytool.exe" -import -alias myalias -file mycertfile
"c:\Program Files\Java\jre6\bin\bin\keytool.exe" -import -alias myalias -file mycertfile
"c:\Program Files (x86)\Java\jre6\bin\bin\keytool.exe" -import -alias myalias -file mycertfile
So it seems that the keytool uses a different store than java.exe
.
因此,keytool 似乎使用与java.exe
.
would appreciate some help on this.
将不胜感激在这方面的一些帮助。
回答by Jus12
I found the solution. Thanks to this link.
我找到了解决方案。感谢这个链接。
It mentioned the location of the keystore. Surprisingly it took a bit of Googling.
它提到了密钥库的位置。令人惊讶的是,它花了一些谷歌搜索。
The location is jre6\lib\security\cacerts
地点是 jre6\lib\security\cacerts
so I had to use the following command to import the certificate:
所以我不得不使用以下命令来导入证书:
keytool.exe -import -alias myalias -file mycertfile -keystore "c:\Program Files\Java\jre6\lib\security\cacerts"
回答by VirtualTroll
You should look at the "Java Application Runtimes Setting" from the Java tab of the Java Control Panel.
http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
From this tab, you can disable/enable any running version and you can see what is the current system JVM version...
您应该从 Java 控制面板的 Java 选项卡中查看“Java 应用程序运行时设置”。
http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
在此选项卡中,您可以禁用/启用任何正在运行的版本,您可以查看当前系统是什么JVM 版本...