loading JKS in Jar in System.setProperty

1k views Asked by At

I am loading property file using getClass.getResourceAsStream();

I m getting jks location from property file - "properties/JKS_FILE_NAME"

this location will be inside the jar when deployed

now this location i set in

System.setProperty(
                  "javax.net.ssl.trustStore",this.KEY_STORE_LOCATION);

Now problem is when packaged inside JAR , this is not able to find the location and says FILE_NOT_FOUND_EXCEPTION

1

There are 1 answers

0
Pavel Horal On

You might want to try JAR protocol when referring to files in a JAR archive. The location should look something like jar:file:/path/to/foo.jar!/path/to/jks.keystore.