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
-Doption of thejavacommand. For example, to run an application namedMyAppand set thejavax.net.ssl.trustStoresystem property to specify a truststore namedMyCacertsFile, type the following:java -Djavax.net.ssl.trustStore=MyCacertsFile MyApp - To set a system property dynamically, call the
java.lang.System.setPropertymethod in your code substituting the appropriate property name and value:
For example, aSystem.setProperty(propertyName,"propertyValue");setPropertycall corresponding to the previous example for setting thejavax.net.ssl.trustStoresystem property to specify a truststore namedMyCacertsFilewould 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.