Execute the following command to find your Java installation directory:
/usr/libexec/java_home
Alternatively, execute the following command directly to add the .crt file to Java cacerts:
keytool -import -alias thekeystore -storepass password -file thekeystore.crt -keystore "$(/usr/libexec/java_home)jrelibsecuritycacerts"
The following figure shows successful execution of the preceding command in a command prompt window:
![](http://imgdetail.ebookreading.net/software_development/51/9781788995979/9781788995979__hands-on-spring-security__9781788995979__assets__7d6189e2-8121-45a1-84e2-d61464d841a4.png)
Figure 4: Exporting .crt file to Java keystore
When setting up a client, make sure that the JDK used is the same as the one in which we have added the .crt file. To reflect the certification addition on to Java, a restart of the machine is suggested.