How to set system property?
Solution 1:
You can do this via a couple ways.
One is when you run your application, you can pass it a flag.
java -Dgate.home="http://gate.ac.uk/wiki/code-repository" your_application
Or set it programmatically in code before the piece of code that needs this property set. Java keeps a Properties
object for System
wide configuration.
Properties props = System.getProperties();
props.setProperty("gate.home", "http://gate.ac.uk/wiki/code-repository");
Solution 2:
System.setProperty("gate.home", "/some/directory");
For more information, see:
- The System Properties tutorial.
- Class doc for
System.setProperty( String key , String value )
.