Freitag, 7. September 2018

MacOS deployment and ship Java Runtime JRE with Eclipse RCP product

This is not quite simple. Please follow the instructions to ship your RCP product with a JRE on MacOS.


You need a working RCP product export with Maven Tycho to build a MacOS product.

1. Install Java Development Kit (JDK) on a MacOS system

Download the installation package from Oracle and install on a MacOS target system. You need a JDK. JRE is not sufficent. Dont't care about the size since we will delete everything but the JRE later on.

2. Copy the JDK to your product

The (for now) current JDK 1.8.181 is installed into that location:


Open a shell and copy the JDK to your development project:
user@mac: cp -R /library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk /Users/peter/...

To uninstall the JDK you have just to delete the JDK directory:
user@mac: rm -rf /library/Java/JavaVirtualMachines/jdk1.8.0_181

Place the content of JDK-directory in the following directory of your exported RCP product:

Open a shell and verify that the following command works properly:
user@mac: /path/to/
     Contents/Home/jre/bin/java -version

3. Specify VM in product configuration

Modify the file YourProduct.ini and add the following 2 lines:


The linebreak between -vm and the path is important!

Since the product is started from the path ../Eclipse/jre leads to the JDK we provided.

You can integrate the -vm option in your product build via the product configuration editor in tab Launch => launch arguments => macosx => programme arguments. Note that the linebreak is not needed there and is added by the build process.

4. Launch the product to test if everything works until now

Uninstall the JDK (rm -rf /library/Java/JavaVirualMachines/jdk1.8.0_181.jdk) and launch your RCP  product. If everything is correct it will use the JDK you provided. Otherwise it will fail to launch.

5. Remove unneeded files from JDK

You can remove a lot of files and directories from folder. You just need:

Remove all other files and directories. Your product will not start anymore but don't worry.

6. Fix Info.plist

The Info.plist contains the option CFBundleExecutable. The setting points to a symbolic link. This link gets broken in the deployment process.

The solution is to simply change CFBundleExecutable:


7. Test and deploy

Launch the product to test that everything works as expected. Integrate the deployment of the JRE into your tycho build.