Sunday, November 9, 2008

How to setup a System Property?

There is a huge difference between system property and environmental variable. Environmental variable has a global effect on the operating system while system property has more local effect. System property can be different from program to program. So it is a best practice to use a system property instead of environmental variable in your code. You can always ask the user to setup the system property.

Running a program with system property is done as follows.

java -Dapplication.home="c:/myapp" MyApplication.java