In order to the secure the JMX channel using SSL, I am launching JAVA using VM arguments 'javax.net.ssl.keystore', and javax.net.ssl.keystorePassword by setting appropriate values. It works fine but with the caveat that I will have to specify keystore password in cleartext while launching my application.

To avoid specifying password in cleartext, I was trying to set above two properties dynamically with-in the code as shown below:
System.setProperty("javax.net.ssl.keystore", "myKeyStore");
System.setProperty("javax.net.ssl.keystorePassword", getKeyStorePwd());

But, somehow the dynamic way of setting these system properties is not working.

I appreciate all your comments in this regard.