Discussion:
[tycho-user] Bundle jre with Eclipse 4.7's .app-bundle on macos
Andreas Pakulat
2018-08-24 19:57:18 UTC
Permalink
Hi,

I'm building an RCP application and recently updated from Eclipse 4.4 as base
to 4.7, along with it comes shipment as a plain app bundle on macOS. I'm also
integrating a JRE installation into the RCP application such that users don't
need to have Java installed. This is done through root-files and worked fine
with Eclipse 4.4.


With Eclipse 4.7 it appears I'm hitting an incompatibility between tycho's
idea where the 'root' of an rcp app is and Eclipse' own idea. The launcher
shipped with Eclipse 4.7-based applications looks for a shipped Java runtime
in the folder '../../jre/Contents/Home/bin' (based on
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c?h=R4_7_maintenance#n46),
where this path is relative to the 'launcher'. It appears 'launcher' here
means the actual binary inside eclipse.app/Contents/MacOS, which makes sense.
In turn that means the 'jre' folder needs to be placed directly inside
eclipse.app, next to the Contents folder there. So the app bundle would look
like this:

myrcp.app/
+- Contents/
| +- Eclipse/
| +- MacOS/
| + myrcp
+- jre/
+- Contents

Unfortunately tycho, when being told to place a 'jre' folder into the 'root'
using this:

root.macosx.cocoa.x86_64=absolute:/Users/andreas/dependencies/JREs/macosx64
root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/bin/java
root.macosx.cocoa.x86_64.link=../Home/lib/jli/libjli.dylib,jre/Contents/MacOS/libjli.dylib

puts the jre folder into myrcp.app/Contents/Eclipse. Thus Eclipse won't find
the JRE and won't start on systems that have no java runtime installed.

I'm mostly wondering if I'm missing something here that I need to tell tycho
now that I've switched the Eclipse version or bundling jre's should be done
differently now?

I saw https://bugs.eclipse.org/bugs/show_bug.cgi?id=519280 where it appears
that using a relative path pointing outside the 'normal' root that tycho uses
may work, but I'm not quite sure how to apply this to my example above - in
particular the link and permissions line.

I'm using the latest tycho release 1.1.0 already.

Andreas
--
Andreas Pakulat ***@froglogic.com
froglogic GmbH - Automated UI and Web Testing
Andreas Pakulat
2018-08-24 20:23:08 UTC
Permalink
Post by Andreas Pakulat
Hi,
I'm building an RCP application and recently updated from Eclipse 4.4 as
base to 4.7, along with it comes shipment as a plain app bundle on
macOS. I'm also integrating a JRE installation into the RCP application such
that users don't need to have Java installed. This is done
through root-files and worked fine with Eclipse 4.4.
With Eclipse 4.7 it appears I'm hitting an incompatibility between tycho's
idea where the 'root' of an rcp app is and Eclipse' own idea. The
launcher shipped with Eclipse 4.7-based applications looks for a shipped
Java runtime in the folder '../../jre/Contents/Home/bin' (based on
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c?h=R4_7_maintenance#n46),
where this path is relative to the 'launcher'. It appears 'launcher' here
means the actual binary inside eclipse.app/Contents/MacOS, which
makes sense. In turn that means the 'jre' folder needs to be placed directly
inside eclipse.app, next to the Contents folder there. So the app
myrcp.app/
+- Contents/
| +- Eclipse/
| +- MacOS/
| + myrcp
+- jre/
+- Contents
Unfortunately tycho, when being told to place a 'jre' folder into the 'root'
root.macosx.cocoa.x86_64=absolute:/Users/andreas/dependencies/JREs/macosx64
root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/bin/java
root.macosx.cocoa.x86_64.link=../Home/lib/jli/libjli.dylib,jre/Contents/MacOS/libjli.dylib
puts the jre folder into myrcp.app/Contents/Eclipse. Thus Eclipse won't find
the JRE and won't start on systems that have no java runtime installed.
I'm mostly wondering if I'm missing something here that I need to tell tycho
now that I've switched the Eclipse version or bundling jre's
should be done differently now?
I saw https://bugs.eclipse.org/bugs/show_bug.cgi?id=519280 where it appears
that using a relative path pointing outside the 'normal' root that
tycho uses may work, but I'm not quite sure how to apply this to my example
above - in particular the link and permissions line.
Oh well, just as I wrote and sent that I can't make out how to leverage this
I finally found the right incarnation:

root.macosx.cocoa.x86_64.folder.../../=absolute:${jreBaseDir}/macosx64
root.macosx.cocoa.x86_64.permissions.755=../../jre/Contents/Home/bin/java
root.macosx.cocoa.x86_64.link=../Home/lib/jli/libjli.dylib,../../jre/Contents/MacOS/libjli.dylib

Works now, the jre is placed two levels up from the Contents/Eclipse/ folder
and the permissions of the various executable files are correct too.

Andreas
--
Andreas Pakulat ***@froglogic.com
froglogic GmbH - Automated UI and Web Testing
Axel Guckelsberger
2018-08-26 09:33:08 UTC
Permalink
Hi,

I am using the setJvm instructions instead of root files:

https://codeiseasy.wordpress.com/2012/07/31/including-a-jre-in-a-tycho-build/

Seems to work fine. I need to rely on the feedback of Mac users though,
as I only have Linux machines.

Regards,
Axel
Post by Andreas Pakulat
Post by Andreas Pakulat
Hi,
I'm building an RCP application and recently updated from Eclipse 4.4
as base to 4.7, along with it comes shipment as a plain app bundle on
macOS. I'm also integrating a JRE installation into the RCP
application such that users don't need to have Java installed. This is
done
through root-files and worked fine with Eclipse 4.4.
With Eclipse 4.7 it appears I'm hitting an incompatibility between
tycho's idea where the 'root' of an rcp app is and Eclipse' own idea.
The
launcher shipped with Eclipse 4.7-based applications looks for a
shipped Java runtime in the folder '../../jre/Contents/Home/bin'
(based on
http://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c?h=R4_7_maintenance#n46),
where this path is relative to the 'launcher'. It appears 'launcher'
here means the actual binary inside eclipse.app/Contents/MacOS, which
makes sense. In turn that means the 'jre' folder needs to be placed
directly inside eclipse.app, next to the Contents folder there. So the
app
myrcp.app/
+- Contents/
| +- Eclipse/
| +- MacOS/
| + myrcp
+- jre/
+- Contents
Unfortunately tycho, when being told to place a 'jre' folder into the
root.macosx.cocoa.x86_64=absolute:/Users/andreas/dependencies/JREs/macosx64
root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/bin/java
root.macosx.cocoa.x86_64.link=../Home/lib/jli/libjli.dylib,jre/Contents/MacOS/libjli.dylib
puts the jre folder into myrcp.app/Contents/Eclipse. Thus Eclipse
won't find the JRE and won't start on systems that have no java
runtime installed.
I'm mostly wondering if I'm missing something here that I need to tell
tycho now that I've switched the Eclipse version or bundling jre's
should be done differently now?
I saw https://bugs.eclipse.org/bugs/show_bug.cgi?id=519280 where it
appears that using a relative path pointing outside the 'normal' root
that
tycho uses may work, but I'm not quite sure how to apply this to my
example above - in particular the link and permissions line.
Oh well, just as I wrote and sent that I can't make out how to
root.macosx.cocoa.x86_64.folder.../../=absolute:${jreBaseDir}/macosx64
root.macosx.cocoa.x86_64.permissions.755=../../jre/Contents/Home/bin/java
root.macosx.cocoa.x86_64.link=../Home/lib/jli/libjli.dylib,../../jre/Contents/MacOS/libjli.dylib
Works now, the jre is placed two levels up from the Contents/Eclipse/
folder and the permissions of the various executable files are correct
too.
Andreas
Loading...