Question

In my project I often encounter Java heap space errors, i.e., there isn't enough space to run the program any more. Is there any way I can increase virtual memory?

I am not using the command-line. I am using Net Beans.

Was it helpful?

Solution

In NetBeans, you can add command line options using the Properties of the Project, the Run option. There is an option for the JVM command line there. Look at the -Xms and -Xmx options.

This works for JRuby projects as well, incidentally.

OTHER TIPS

Under Netbeans you can set the VM options for a project, in the project properties. Under Properties > Run the last box should be VM Options. Netbeans will use those when running the app.

Java -X, read about java -Xms and -Xmx

Use the command line arguments when invoking JVm as,

java -Xms -Xmx

Running JAR directly is on longer suggested (from Sun) (someone may disagree).

You are suggested to use WebStart/JNLP, applet, or exe/batch wrapper that you can control the startup behaviour of the JVM.

The another way you can do is that implement your own wrapper in Java. i.e. fork the real java.exe with -Xmx in your main() function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top