Am I right in thinking that when one specifies VM arguments in an IDE (I'm using NetBeans in this instance), that these arguments are only passed when the code is run through the IDE itself?
Essentially, I'd like to specify that when my program runs, the VM's minimum/initial heap size is 2Gb. I can do this using the -Xms2048m command, but I'm wondering if there's some way to achieve this without having to type a command (for the customer's sake).
Even thought I set the VM argument in NetBeans, and Launch4J (I wrap the JAR into an EXE file), when the program boots & outputs the Runtime's total memory size, it always gives ~120Mb.
What am I missing?
Edit: I output the total memory size using...
int mb = 1024 * 1024;
System.out.println("Max Memory: " + Runtime.getRuntime().totalMemory() / mb);
Edit 2: Could one not create a initialising program that takes no arguments, but starts the main program with the relevant VM arguments? Something like...
public class Main {
public static void main(String[] args) {
String execName = new File(new File("").getAbsolutePath()) + "\\Program.exe";
Runtime rt = Runtime.getRuntime();
rt.exec("java -Xms2048m -Xmx4096m -jar " + execName);
}
}