Code Sample:
public static void main(String[] args) { String property = System.getProperty("my.text"); System.out.println(property); } |
Execution:
java -Dmy.text="Hello World." -jar /home/user/application.jar |
Note: With java -D
you can set every property you like except the reserved ones, listed in [post id=2219]Java System Properties[/post].
You can set multiple properties with the following command:
java -Dmy.text="Hello World." -Dmy.ide="NetBeans IDE" -Dmy.browser="Mozilla Firefox" -jar /home/user/application.jar |