I use ssl to secure RMI and JMS communications between clients and server. I add keyStore and trustStore files to resource folder of my project. When the project run through Netbeans, these file are loaded without any problem, using below codes:
System.setProperty("javax.net.ssl.keyStore", "src/main/resources/certificates/keyStore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pass");
System.setProperty("javax.net.ssl.trustStore", "src/main/resources/certificates/trustStore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pass");
But, when I run this project through its jar file, these files cannot be loaded.
Is there any alternate way to config SSL instead of using System.setProperty() and specifying the paths to keyStore and trustStore files?
Also, it works in both modes (run through Netbeans and Jar file).