Hi,
I've made some experiments of a more "p2-native" way to embed a JRE some time ago, hoping it will allow one day to ship a JRE with Eclipse IDE directly (but this is currently stuck for legal reason).
In
https://github.com/mickaelistria/org.eclipse.epp.packages/tree/506244 , you can see in the "runtime" folder some p2 units that include a JRE (OpenJ9+OpenJDK from AdoptOpenJDK in that case), and have touchpoints to set the `-vm` flag for the product when they're installed. With this approach, just including those units in your product make it use the included JRE. A cool thing is that the JRE is then a regular p2 unit, so it can be uninstalled and updated like anything else, without any specific workflow.
It was only tested on Linux and would require update to newer AdoptOpenJDK build to support macOS.
It's a piece of work that's currently stalled on my end because I'm waiting for legal approval before spending more effort on it. If you're going to use it, you can just copy it, it's EPL. And if you do, please consider writing a good blog post about it as I think this approach deserve to be made more popular ;)
Cheers,