To set system property in Java, use
System.setProperty
.Here's how you do it:
System.setProperty("myProperty", "Hello World!");
System.out.println(System.getProperty("myProperty")); // Hello World!
As a Java argument
You can also set it by passing an argument starting with -D
to the java
command:
java -DmyProperty="Hello World!" …