简体   繁体   English

java system.setproperty是否有替代方法?

[英]Is there an alternative for java system.setproperty?

System.setProperty("javax.net.ssl.trustStore", "cacerts.jks");

SSLSocketFactory ssf = (SSLSocketFactory) SSLSocketFactory.getDefault();

I would want to implement my SSL socket for my server and client. 我想为服务器和客户端实现SSL套接字。 There is this System.setproperty i am trying to replace with bufferedreader like stuff to read in the certificate. 我正在尝试使用bufferedreader替换该System.setproperty这样的东西以读取证书。 Can it be done? 能做到吗

Unsure about reading the certificate, but you can make use of VM Arguments. 不确定要读取证书,但是可以使用VM参数。 Eg: -DmyProp='propValue' 例如:-DmyProp ='propValue'

Refer: http://www.avajava.com/tutorials/lessons/whats-the-difference-between-program-arguments-and-vm-arguments.html 请参阅: http : //www.avajava.com/tutorials/lessons/whats-the-difference-between-program-arguments-and-vm-arguments.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM