Ponderings of a kind

This is my own personal blog, each article is an XML document and the code powering it is hand cranked in XQuery and XSLT. It is fairly simple and has evolved only as I have needed additional functionality. I plan to Open Source the code once it is a bit more mature, however if you would like a copy in the meantime drop me a line.

Atom Feed

NetBeans Platform Application - Memory Settings

For applications that arent small

I have been working on an application for annotating TEI texts on behalf of Oxford University Computing Services. The application embeds the oXygen XML Author v12 into the NetBeans Platform v6.9, whilst severely restricting the functionality of oXygen. The purpose of restricting oXygen is to simplify the UI and options available to the end user; The user may not have a high level of computer literacy.

I had a problem whereby opening a large TEI document in the application failed to work. The problem turned out to be a lack of available memory for the application.

NetBeans allows you to build installers for your application for a variety of Operating Systems, however by default it ships a configuration file ($app_dir/etc/app_name.conf) with your application, that restricts the memory to a maximum of just 64MB!

Increasing this option is not obvious or well documented, after some Googling, searching of the NetBeans Platform forum and some trial and error, I have managed to increase this setting that is installed by the Installers.

Step 1 - Build the Installers

NetBeans build installers

Step 2 - Examine the file - build/launcher/etc/app_name.conf

# ${HOME} will be replaced by user home directory according to platform
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding teiannotator -J-Xms24m -J-Xmx64m"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)

The line of interest is the one starting "default_options", -J-Xmx64m indicates that the maximum memory for your NetBeans Platform Application will be 64MB

Step 3 - Increase the memory setting

As the file in step 2 is generated automatically when you build the installers, you need to override this setting in the build itself. This can be done by modifying your build.xml file. e.g. -

<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="TEI Annotator NB Application" basedir=".">
<description>Builds the module suite TEI Annotator NB Application.</description>
<import file="nbproject/build-impl.xml"/>

<target name="build-launchers" depends="">
<replace file="build/launcher/etc/${}.conf" token="--branding teiannotator -J-Xms24m -J-Xmx64m" value="--branding teiannotator -J-Xms24m -J-Xmx384m"/>


Step 4 - Re-Build the Installers

...And your done :-)

Adam Retter posted on Saturday, 2nd October 2010 at 22.00 (GMT+01:00)
Updated: Saturday, 2nd 2010 at October 22.00 (GMT+01:00)

tags: NetBeansTEIjavaoXygenXmxmemory

Comments (2)

This is no longer correct.%0D%0AIn NB 6.9.1 the file to edit is your IDEPATH%2Fharness%2Fetc%2Fapp.conf%0D%0A
Ok so that last posting didnt work.
You need to edit

Add Comment

(will not be shown)

Tag Cloud