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!

Comments:

The option "-J-XX:+CMSClassUnloadingEnabled" is not listed on the command set you said you use, just on the description list. And those options are available at netbeans.conf file, just need to uncomment it, great.

Posted by Claudio Miranda on December 16, 2005 at 12:09 PM CST #

Hi, Charlie, just to let you known I started to develope a module to configure netbeans startup settings, see it: http://weblogs.java.net/blog/claudio/archive/2005/12/netbeans_plugin.html \* do you know if roller has trackbacks ? because I wanted to link back to your blog entry, but didn't see any trackback link.

Posted by Claudio Miranda on December 18, 2005 at 02:10 AM CST #

Claudio, I'd been doing some experimenting with some of the permanent generation space with CMS. That's how I managed to not show the CMSClassUnloadingEnabled switch initially. I have been using it lately along with another switch, -XX:+CMSPermGenPrecleaningEnabled. So, in netbeans.conf I have added -J-XX:+CMSPermGenPrecleaningEnabled.

Posted by charlie hunt on December 24, 2005 at 01:09 AM CST #

Claudio, I just looked at the graphic you have of your module / plugin for viewing and setting command line args for NetBeans. Muito boa!!! I love it!

Posted by charlie hunt on December 24, 2005 at 01:13 AM CST #

Post a Comment:
Comments are closed for this entry.
About

charliebrown

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today