NetBeans IDE: Adding/Changing JVM command line args
I had a question on how to add/change JVM command line args show up in my inbox from a good friend I met in Brazil, Keuller Magalhaes.
Somehow have the feeling there are other NetBeans users who have had the same question.
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. I have NetBeans IDE 5.0 Beta2 installed at /opt/netbeans-5.0beta2
2. In that directory, go to the 'etc' directory. In my installation, that path would be, /opt/netbeans-5.0beta2/etc.
3. In that 'etc' directory, there is a file called 'netbeans.conf'.
Open that netbeans.conf file and you'll see something that looks like:
# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/5.0beta2"
# options used by netbeans launcher by default, can be overridden by explicit
# command line switches
netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=96m -J-ea -J-Dapple.laf.useScreenMenuBar=true"
# default location of J2SE JDK, can be overridden by using --jdkhome <dir> switch
netbeans_jdkhome="/usr/jdk/jdk1.5.0_05"
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"
You'll see there's a line for 'netbeans_default_options'. You can add or change your favorite JVM options there. For instance, here is the set of command line options I usually use:
netbeans_default_options="-J-Xms128m -J-Xmx384m -J-XX:NewRatio=20 -J-XX:+UseConcMarkSweepGC -J-XX:+UseParNewGC -J-XX:+CMSPermGenSweepingEnabled -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenPrecleaningEnabled -J-XX:PermSize=64m -J-XX:MaxPermSize=96m -J-Dswing.aatext=true"
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.
Also notice there is '-J' in front of the JVM command line args and in front of the system property '-Dswing.aatext=true'.
Wouldn't it be great to have a NetBeans plug-in that would let you edit this file from within the NetBeans IDE? That might be a great idea for a NetBeans plug-in for Desafio NetBeans!
Thanks for the question Keuller!
Posted at 11:35AM Dec 08, 2005 by charliebrown in Java | Comments[4]
Posted by Claudio Miranda on December 16, 2005 at 08:09 PM CST #
Posted by Claudio Miranda on December 18, 2005 at 10:10 AM CST #
Posted by charlie hunt on December 24, 2005 at 09:09 AM CST #
Posted by charlie hunt on December 24, 2005 at 09:13 AM CST #