How do I set System properties?
Author: Deron Eriksson
Description: This Java tutorial shows how to set System properties.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1

Page: < 1 2

(Continued from page 1)

If we click on the Arguments tab, we can see that there's a box to enter VM arguments. In this example, I pass in the following arguments:"Nissan 350Z"

A "-D" is placed in front of each system property that we are passing in as a VM argument, and following this is an equal sign followed by the value of that system property. Note how the "" system property value is surrounded by quotation marks since it contains a space in the String value.

SetSystemProperties Debug Configuration with VM Arguments

If we execute our debug configuration with the two new system property key/value pairs passed in as VM arguments, we observe the following.

Execution of Debug Configuration

All four system properties that we retrieve now have values for them. The first two are set programmatically while the second two are passed in as arguments to the JVMW.

Page: < 1 2