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:
java <vmarguments.txt> VMArgumentsFromFile
Where the contents of vmarguments.txt is:
-Dvmopttest=Success
And the contents of VMArgumentsFromFile.java is:
public class VMArgumentsFromFile {
public static void main(String[] args) {
System.out.println(System.getProperty("vmopttest","Fail");
}
}
What is proper command line entry to get this program to output "Success" on a Windows system?
There are a couple of questions close to this (here and here) 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.