NetBeans Platform Application - Memory Settings
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
Step 2 - Examine the file - build/launcher/etc/app_name.conf
# ${HOME} will be replaced by user home directory according to platform default_userdir="${HOME}/.${APPNAME}/dev" 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 #jdkhome="/path/to/jdk" # clusters' paths separated by path.separator (semicolon on Windows, colon on Unices) #extra_clusters=
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="suite.build-launchers"> <replace file="build/launcher/etc/${app.name}.conf" token="--branding teiannotator -J-Xms24m -J-Xmx64m" value="--branding teiannotator -J-Xms24m -J-Xmx384m"/> </target> </project>
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)
Comments (2)
Posted by Steve on Tuesday, 19th October 2010 at 12.31 (GMT-07:00)
Posted by Steve on Tuesday, 19th October 2010 at 12.33 (GMT-07:00)