title: Loading VM arguments from a file when running a Java application on Windows
body: <p>I want to be able to run my Java program VMArgumentsFromFile (detailed below) from the command line and print out "Success" in the command prompt. The command line entry should look something like this:</p>
  
  <pre><code>java &lt;vmarguments.txt&gt; VMArgumentsFromFile
  </code></pre>
  
  <p>Where the contents of vmarguments.txt is:</p>
  
  <pre><code>-Dvmopttest=Success
  </code></pre>
  
  <p>And the contents of VMArgumentsFromFile.java is:</p>
  
  <pre><code>public class VMArgumentsFromFile {
  
     public static void main(String[] args) {
        System.out.println(System.getProperty("vmopttest","Fail");
     }
  }
  </code></pre>
  
  <p>What is proper command line entry to get this program to output "Success" on a Windows system?</p>
  
  <p>There are a couple of questions close to this (<a href="https://stackoverflow.com/questions/321140/putting-jvm-arguments-in-a-file-to-be-picked-up-at-runtime">here</a> and <a href="https://stackoverflow.com/questions/4866388/passing-an-entire-file-to-jvm-arguments">here</a>) but neither address this specific case I'm presenting. Please do not provide answers solving this from within the Java program (like sending the filename as a vm parameter and then setting its contents programmatically). In practice, the answer to this question will be used to send a number of different applications the same vm arguments which will be consolidated in one text file.</p>