How to Specify a java.lang.system Property

Some aspects of JSSE may be customized by setting system properties. You can set a system property either statically or dynamically:
  • To set a system property statically, use the -D option of the java command. For example, to run an application named MyApp and set the javax.net.ssl.trustStore system property to specify a truststore named MyCacertsFile , type the following:
    java -Djavax.net.ssl.trustStore=MyCacertsFile MyApp
  • To set a system property dynamically, call the java.lang.System.setProperty method in your code substituting the appropriate property name and value:
    System.setProperty(propertyName,"propertyValue");
    For example, a setProperty call corresponding to the previous example for setting the javax.net.ssl.trustStore system property to specify a truststore named MyCacertsFile would be:
    System.setProperty("javax.net.ssl.trustStore","MyCacertsFile");
In the Java™ Deployment environment (Plug-In/Web Start), there are several ways to set the system properties. For more information, see Java Platform, Standard Edition Deployment Guide.
  • Use the Java Control Panel to set the Runtime Environment Property on a local or per-VM basis. This creates a local deployment.properties file. Deployers can also distribute an enterprise wide deployment.properties file by using the deployment.config mechanism. For more information, see Deployment Configuration File and Properties.
  • To set a property for a specific applet, use the HTML subtag <PARAM> "java_arguments" within the <APPLET> tag. For more information, see the Command-line Arguments section of the Java Platform, Standard Edition Deployment Guide.
  • To set the property in a specific Java Web Start application or applet using Plugin2, use the JNLP property sub-element of the resources element. For more information, see resources Element.