Netbeans Platform: excluding locales from zip and installer distribution

This article explains how to prevent Netbeans RCP from packaging unwanted locales into the zip distribution and installers.

This article originally appeared on

Current situation:

  • The default Netbeans RCP build always includes all localization jars from the harness directory: Russian, Chinese, Japanese and Brazilian Portuguese.
  • Netbeans project properties and branding properties lack configuration to select bundled languages.
  • The build templates did not foresee features to exclude locales.


  • Annoying long build times. Proportional to the number of jars, build time increases by five if all default languages are included.
  • Larger distributable artifact size. Localization jars take about 500kB.


  • Netbeans Ant build is reasonably organized by build templates. And Ant allows overriding targets inherited from templates.
  • We override the build-zip target. This target generates the .zip distribution artifact, which also serves a input for the installer.

The modified script:

The original build-zip target (netbeans 8.0) is found in the harness directory of your Netbeans installation. We place an adapted copy into the build.xml of your application root directory, thus overriding the behavior of the original target. The red lines were added to prevent adding localization for Russian, Chinese and Japanese.

<target name="build-zip" depends="build,build-launchers" description="Builds a ZIP distribution of the suite, launchers, and selected modules from the platform.">
    <echo message="Custom Build ZIP" />
   <mkdir dir="${dist.dir}"/>
   <!-- pathfileset does not support 'prefix' and 'filemode' parameters,
        we have to copy them to temp location -->
   <tempfile property="temp.dir.nbexec" destdir="${}" deleteonexit="true" prefix="nbexec"/>
   <tempfile property="" destdir="${}" deleteonexit="delete" prefix="rest"/>
   <subant genericantfile="${harness.dir}/suite.xml" target="copy-cluster" inheritrefs="true">
       <property name="dest.dir" value="${}"/>
       <property name="nbexec.dir" value="${temp.dir.nbexec}"/>
       <property name="build.dir" value="${}"/>
       <resources refid="zip.platform.clusters"/>
   <zip destfile="${dist.dir}/${}.zip">
       <zipfileset dir="${build.launcher.dir}/bin/" filemode="755" prefix="${}/bin"/>
       <zipfileset dir="${build.launcher.dir}/etc/" prefix="${}/etc"/>
       <zipfileset dir="${temp.dir.nbexec}" filemode="755" prefix="${}"/>
       <zipfileset dir="${}" prefix="${}"><exclude name="config/Modules/*.xml_hidden"/>
           <exclude name="**/*_ja.jar" />
           <exclude name="**/*_ru.jar" />
           <exclude name="**/*_zh_CN.jar" />

       <!-- Yes, the doubled is a bit ugly, but better than the alternative; cf. #66441: -->
       <zipfileset dir="${cluster}" prefix="${}/${}">
           <exclude name="config/Modules/*.xml_hidden"/>
           <exclude name="**/*_ja.jar" />
           <exclude name="**/*_ru.jar" />
           <exclude name="**/*_zh_CN.jar" />