You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Jens Hofschröer <ap...@nigjo.de> on 2018/06/12 09:24:46 UTC

Custom Rumtime Image for RCP Applications

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-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org

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




Re: Custom Rumtime Image for RCP Applications

Posted by Oliver Rettig <Ol...@orat.de>.
Hi Jens,
that is interesting. Thanks for sharing it. I will give it a try.
best regards
Oliver
> 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