2 Minutes To Code (β Version)

'java' command - 2 minute tutorial

How to set system property for use in java class

When you launch a jvm (i.e. run the java command), you can pass some system properties as command line options.

The jvm passes on these properties to teh java app. The java app can get these using the String System.getProperty(String) api.

For e.g. to pass a system property server_type with value as test_server, you can the following comamnd java -Dserver_type=test_server HelloWorld .

See another example in the image below.