Skip to content

portfolio-performance/bundled-jre

Repository files navigation

About

An Eclipse feature of OSGi bundles packaging the Java Runtime Engine (JRE) for Windows, Mac, and Linux. It is used to bundle and distribute the JRE with the Portfolio Performance Eclipse e4 application.

From a license perspective, I wanted to use the OpenJDK for my open source program. The OpenJDK itself is not providing binaries for all platforms, but thankfully Azul does with Zulu. Check out this OpenSource StackExchange on a discussion why the Oracle JRE does not work well with FOSS.

The Idea

In short, the idea is outlined in the blog post Including a JRE in a Tycho build.

The Tycho build in this repository does:

  • Download the JDK builds from Zulu
  • Create bundles with the appropriate setJvm p2 Touchpoint Instructions
  • Create a feature with all JRE bundles and a repository for use in other builds

Notes

The Java version is configured in bundles/pom.xml:

<properties>
  <download.url>https://cdn.azul.com/zulu/bin/</download.url>
  <download.file>zulu21.36.17-ca-jre21.0.4-</download.file>
  ...
</properties>

Review the p2.inf - no change needed. The p2.inf files have to be generated during the build because they must contain the correct path - including the version. On Linux and macOS, additionally executable permissions must be set.

instructions.configure = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:../Eclipse/plugins/name.abuchen.zulu.jre.macosx.aarch64_${version}/jre/Contents/Home/lib/libjli.dylib);

instructions.unconfigure = \
  org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:null);

instructions.install = \
  org.eclipse.equinox.p2.touchpoint.eclipse.chmod(targetDir:${installFolder}/plugins/name.abuchen.zulu.jre.macosx.aarch64_${version}/jre/Contents/Home/,targetFile:bin,permissions:755,options:-R);\
  org.eclipse.equinox.p2.touchpoint.eclipse.chmod(targetDir:${installFolder}/plugins/name.abuchen.zulu.jre.macosx.aarch64_${version}/jre/Contents/Home/lib,targetFile:jspawnhelper,permissions:755);\

Then add the feature to the product definition:

<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product name="My Product" ... >

   <features>
      <feature id="my.feature"/>
      <feature id="org.eclipse.e4.rcp"/>
      ...

      <feature id="name.abuchen.zulu.jre.feature"/>
      
   </features>
</product>

Building

Build with Maven 3.x:

mvn clean verify

Update the versions using the Tycho versions plugin:

mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=21.0.4