title: Proper usage of Java -D command-line parameters
body: <p>When passing a -D parameter in Java, what is the proper way of writing the command-line and then accessing it from code? </p>
  
  <p>For example, I have tried writing something like this...</p>
  
  <pre><code>if (System.getProperty("test").equalsIgnoreCase("true"))
  {
     //Do something
  }
  </code></pre>
  
  <p>And then calling it like this...</p>
  
  <pre><code>java -jar myApplication.jar -Dtest="true"
  </code></pre>
  
  <p>But I receive a NullPointerException. What am I doing wrong?</p>