Wednesday, May 14, 2008

NetBeans IDE: Adding/Changing JVM command line args

You can indeed set your favorite JVM command line args to use with NetBeans. Here's how to do it.

1. Go to the directory where you installed NetBeans IDE.

2. In that directory, go to the 'etc' directory.

3. In that 'etc' directory, there is a file called 'netbeans.conf'.

Open that netbeans.conf file


Here's an explanation of the command line switches I use:
-J-Xms128m -> initial Java heap size
-J-Xmx384m -> max Java heap size
-J-XX:NewRatio=20 -> Ratio of old generation to young generation space
-J-XX:+UseConcMarkSweepGC -> use the concurrent old generation garbage collector
-J-XX:+UseParNewGC -> use the parallel young generation garbage collector
-J-XX:+CMSPermGenSweepingEnabled -> enable concurrent gc in permanent generation
-J-XX:+CMSClassUnloadingEnabled -> enable class unloading in permanent generation with the concurrent gc collector
-J-XX:+CMSPermGenPrecleaningEnabled -> enable pre-cleaning when using concurrent gc collector in permanent generation
-J-XX:PermSize=64m -> initial size of permanent generation space set to 64m
-J-XX:MaxPermSize=96m -> max size of permanent generation space set to 96m
-J-Dswing.aatext=true -> use font anti-aliasing

* Keep in mind that I am running on a machine with 1G of RAM. However, these settings should work fine on a machine with 512m. Just keep an eye on swapping activity. If you can keep your system from swapping, you're responsiveness will be much better.

No comments: