I have a keystore that is located on the top level of my .jar file. To build a TLS SSLSocket from it I need to set it as SystemProperty using
Properties systemProperties = System.getProperties();
systemProperties.put("javax.net.ssl.keyStore", "<relative Path to File>");
systemProperties.put("javax.net.ssl.keyStorePassword", "<password>");
System.setProperties(systemProperties);
My class file from which this code is being executed sits here in the .jar file:
server.jar
|
|-com
| |-organization
| |-application
| |-frontend
| |-Server.class <-- This needs the keystore
|
|-keystore.jks <-- this is the keystore
I already tried a lot of different paths however none of them worked until now. When running the application in Eclipse my current (and working) relative path is "./auth/labkey.jks" as "auth" is a folder which resides on the same file hierarchy level as the src folder in which the code is stored.
I would be really grateful for any tips on how the relative path I need to use should look like. I'm well aware that there apparently is the possibility to use ClassLoader to access this file properly, however my problem is not the loading process but rather that I can not refer to the file (which I also need to do when using ClassLoader), so suggesting that I should use ClassLoader is not helping me solve the main problem at this point.