Hi

I am testing a little bit with Custom Runtime Images for our RCP Application and want to share my experiences. Our custom image is
created by the following Ant snippet.

${gtbjdk.home} is the used JDK home directory and ${gtbjdk.dir} is the destination folder name.


    <loadresource property="jlink-modules">
      <concat>
        <union>
          <string>java.desktop,</string>
          <string>java.instrument,</string>
          <string>java.logging,</string>
          <string>java.naming,</string>
          <string>jdk.localedata,</string>
          <string>jdk.management,</string>
          <string>jdk.pack,</string>
<string>jdk.jdwp.agent,</string><!-- only to be able to debug the rcp app -->
        </union>
      </concat>
    </loadresource>
    <loadresource property="jlink-locales">
      <concat>
        <union>
          <string>en,</string>
          <string>de,</string>
          <string>pt-BR,</string>
        </union>
      </concat>
    </loadresource>

<exec executable="${gtbjdk.home}/bin/jlink${jlinkext}" failonerror="true" if:set="dojlink">
      <env key="JAVA_HOME" path="${gtbjdk.home}"/>
      <arg value="--strip-debug"/>
      <arg value="--no-header-files"/>
      <arg value="--no-man-pages"/>
      <arg value="--output"/>
      <arg value="${temp.dir.rest}/${gtbjdk.dir}"/>
      <arg value="--module-path"/>
      <arg value="${gtbjdk.home}/jmods"/>
      <arg value="--add-modules"/>
      <arg value="${jlink-modules}"/>
      <arg value="--include-locales=${jlink-locales}"/>
      <!--<arg value="- -vm=server"/>-->
    </exec>
<echo level="info" if:set="dojlink">Created JRE in ${temp.dir.rest}/${gtbjdk.dir}</echo>


The tasks are executed as dependecy of the "build-zip" target and after "build-launchers". On Success the generated JRE-Path is set directly in our app.conf:

<available file="${temp.dir.rest}/${gtbjdk.dir}" property="gtbjre.exist"/>
    <replace if:set="gtbjre.exist"
             file="${build.launcher.dir}/etc/${app.name}.conf"
             value="jdkhome=./${gtbjdk.dir}">
      <contains text="#jdkhome"/>
      <replacetoken><![CDATA[#jdkhome="/path/to/jdk"]]></replacetoken>
    </replace>

The generated Runtime Image is about 64 MB from an Oracle JDK 9.0.4 (win64)

Greetings
Jens

--
http://blog.nigjo.de/netbeans/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.incubator.apache.org
For additional commands, e-mail: dev-h...@netbeans.incubator.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to