开发者

c:\Windows\System32\java.exe default cert store location?

开发者 https://www.devze.com 2023-03-08 14:49 出处:网络
I have not set java_home and I need to know where the c:\\Windows\\System32\\java.exe file points to.

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.

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)

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.

Is there an easy way to find out which JRE is the default one?

[EDIT] Or rather I need to find the location of the default keystore in the default JRE.

[EDIT] My problem is elaborated below:

the following two give SSL error:

"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.

would appreciate some help on this.


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

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"


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消