Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how do I bundle a jre with an RCP appl on Mac OSX
how do I bundle a jre with an RCP appl on Mac OSX [message #1102156] Thu, 05 September 2013 12:45 Go to next message
Tom Brus is currently offline Tom BrusFriend
Messages: 26
Registered: February 2011
Junior Member
Hi,

We are making an RCP appl with kepler.
I want to ship the jre's with the appl.
On windows I can just ship a jre dir in the root, no problem.

On the Mac (10.8.4) it does not seem to work, at least not in an obvious way.
I downloaded the latest 1.7 jre (25) for Mac from the oracle website.

I tried the following:

  1. unzip it and put it in a jre dir in the root => not used, falling back to system jre
  2. same and put '-vm' in the ini => error saying 1.6.0_51 is not supported (huh? I do not even have 1.6)


I tried exporting an appl (with bundled jre) from eclipse using the product definition. That works but when I look at the generated appl tree I see a jre dir with another jre dir inside it ??? The inner jre dir seems to be a (partial) duplicate of the outer one.

Ok, sort of at least, now I tried to copy my downloaded jre dir inside itself. That works, but if I remove the contents of one of them it does not work anymore Shocked and I do not really want to ship a double jre.

Can anybody shed some light here?
What is the optimal way to bundle a jre with an RCP application on Mac OSX?

Thanks,
Tom
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1105444 is a reply to message #1102156] Mon, 09 September 2013 21:59 Go to previous messageGo to next message
Tom Brus is currently offline Tom BrusFriend
Messages: 26
Registered: February 2011
Junior Member
Hmm, nobody knows....

Can anybody point me to the source code in the product exporter where that jre is copied in Kepler?

-Tom
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1123351 is a reply to message #1102156] Wed, 02 October 2013 13:30 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
I have the same problem under MacOSX. I found no solution until now. Very annoying.
Did anyone know a solution?
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1123417 is a reply to message #1123351] Wed, 02 October 2013 14:43 Go to previous messageGo to next message
Tom Brus is currently offline Tom BrusFriend
Messages: 26
Registered: February 2011
Junior Member
Good to know I am not alone Wink...
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1126360 is a reply to message #1102156] Sat, 05 October 2013 13:06 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
I think i found a running solution. After hours of searching the internet and dozens of unsuccessful tries i did the following:

I copied an installed JDK to my RCP folder, renamed it to jre and then adjusted my product *.ini file to use a different vm in a relative folder.

-vm
../../../jre/Contents/Home/jre/bin/java
-vmargs
-XX:MaxPermSize=256m

....etc.

It is important that after the -vm flag a linbreak occurs and it is written before the -vmargs arguments.

A relative path was important for me so that i can distribute the product.

After the first successful start i removed all files from the JDK Home folder except the jre folder.

I do not know why i have to copy the folder structure like this but it worked.

Maybee this approach also works with an JRE and a similar folder structure.

Here my folder structure as an overview and help:

....
....
MyApp
configuration
features
jre
...../Contents/
..................Home/
...........................jre
..................info.plist
..................MacOS
p2
plugins
readme

I hope this information also works for you.

[Updated on: Sat, 05 October 2013 15:57]

Report message to a moderator

Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1623773 is a reply to message #1102156] Thu, 19 February 2015 10:11 Go to previous messageGo to next message
Lampros Gk is currently offline Lampros GkFriend
Messages: 6
Registered: February 2015
Junior Member
Hello ,

There is a useful post on this topic. It helped me a lot.

I cannot write the link (I have less than messages in this forum) but you can search for "Bundling a Java Runtime Environment (JRE) with an Eclipse RCP application" on blog.dadabeatnik.com
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1636512 is a reply to message #1623773] Thu, 26 February 2015 08:18 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
And did it work for you on the latest 10.x release? Because that's a problem.

Until now i had no success to find a satisfying solution ( i have to execute a shell script).

Please note that Pascal Rapicault is working on a *.dmg export for Eclipse 4.5 M7, see:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=431116

Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1699825 is a reply to message #1636512] Fri, 26 June 2015 21:48 Go to previous messageGo to next message
Jim Klo is currently offline Jim KloFriend
Messages: 49
Registered: September 2012
Member
I have done this within our product and have it working. It's tricky because if you're using Maven to build, OS X's JRE symlink's libjvm.dylib - which Java's unzip invariably screws up.

I was only able to get this to work by using Tycho, as the app export within the PDE is just plain broken (and seemingly unmaintained). This bug has been there for quite some time - I don't have any faith in it ever getting fixed, regardless of whatever bugzilla says.

If you're building RCP apps for distribution - you should probably consider using Tycho anyways; admittedly there's a lot of BS that comes with it, but it's the only seemingly straightforward way to build and package an RCP app in a headless manner for continuous integration. Buckminster is supposedly also a solution - but it has less information and support than Tycho - so YMMV.

Anyways back to your problem. Using Tycho with some custom maven magic, I was able to solve this. Essentially I downloaded the JRE from Oracle, and uploaded to our Artifactory so I could reference it using maven coordinates. I unpack that tar.gz package into the OS X distribution directory and place the package under the <your app name>.app/jre. Because of the symlink munging - you have to go and fix that, so remove the existing zero byte libjvm.dylib and relink it using ant exec. Now that you have a good JVM, you need to modify the config.ini to use the right JRE. Unfortunately you can only build this on OS X or Linux - Windows is SOL unless you can find a way to use Cygwin or equivalent. Since I'm doing this outside of Tycho's archiving phase (and theres not apparently way to slip my changes in between), I have to recreate the OS X archive.

Hopefully this helps you solve your problem... I beat my head against the wall trying to fix this for several weeks trying to find a working solution as the error reporting is completely incorrect.

Anyways, good luck!

<profiles>
		
		<profile>
			<id>fix-jre-archives</id>
			<activation>
				<os><family>unix</family></os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>com.sri</groupId>
				    <artifactId>oracle-jre</artifactId>
				    <version>${distrib.oracle-jre.version}</version>
				    <classifier>macosx-x64</classifier>
				    <type>tar.gz</type>
				</dependency>
			</dependencies>
			<build>
			<plugins>
				<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.8</version>
				<executions>
					<execution>
						<id>unpack-mac-jre</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>com.sri</groupId>
								    <artifactId>oracle-jre</artifactId>
								    <version>${distrib.oracle-jre.version}</version>
								    <classifier>macosx-x64</classifier>
								    <type>tar.gz</type>
									<outputDirectory>${distrib.macosx.x86_64}</outputDirectory>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				  <executions>
					<execution>
						<id>fix-jre-mac</id>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>						
								<mkdir dir="${distrib.macosx.x86_64}/${distrib.bin.name}.app"/>
								<move file="${distrib.macosx.x86_64}/jre${distrib.jre.version}.jre" tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre"/>
								<symlink action="delete" link="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre/Contents/MacOS/libjli.dylib" />
								<symlink link="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre/Contents/MacOS/libjli.dylib"
									resource="../Home/lib/jli/libjli.dylib" overwrite="true"/>
								
								
								<concat destfile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}_temp.ini" fixlastline="yes">
									<header filtering="no" trimleading="yes">
									-vm
									../../jre/Contents/Home/lib/server/libjvm.dylib
									</header>
									<fileset file="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini"/>
								</concat>
								<move file="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini"
								 	tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}_bak.ini" />
								<move file="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}_temp.ini" 
									tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini" />
							</target>
						</configuration>
					</execution>
					<execution>
						<id>remove-director-archive-mac</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<delete file="${archive.macosx.x86_64}" />
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>exec-maven-plugin</artifactId>
					<version>1.3.1</version>
					<executions>
						<execution>
							<id>manual-archive-mac</id>
							<phase>pre-integration-test</phase>
							<goals>
								<goal>exec</goal>
							</goals>
							<configuration>
								<executable>zip</executable>
								<workingDirectory>${distrib.macosx.x86_64}/..</workingDirectory>
								<arguments>
									<argument>-r</argument>
									<argument>-q</argument>
									<argument>-dd</argument>
									<argument>--symlinks</argument>
									<argument>${archive.macosx.x86_64}</argument>
									<argument>${distrib.root}</argument>
								</arguments>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
			</build>
		</profile>
	</profiles>
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1700791 is a reply to message #1699825] Tue, 07 July 2015 09:06 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
It is possible to create a decent *.app on MacOSX with Eclipse 4.5 and PDE!

I already notes this on Bugzilla:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=468131

If you define as an export folder in the PDE GUI:

'Your.app/Contents' (The 'Contents' folder must be available)

Root directory: 'Eclipse' (it is important not to change the name here!)

then it creates a regular executable *.app application. It should be reproducable with the RCP Mail example.

I'm was also able to bundle a JRE by setting the -vm switch in the *.ini file to
-vm
jre/lib/jli/libjli.dylib
(take care of the linebreak!)

Location of the JVM in the app bundle: My.app/Contents/MacOS/jre

That should help.

[Updated on: Tue, 07 July 2015 09:07]

Report message to a moderator

Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1759143 is a reply to message #1700791] Thu, 06 April 2017 20:59 Go to previous message
Arian Fornaris is currently offline Arian FornarisFriend
Messages: 8
Registered: February 2014
Junior Member
So many thanks Marcel Austenfeld, your solution just worked (in El Capitan and Eclipse Neon.1), to set Eclipse as the root folder is the key!!!!
Previous Topic:How to use deeplinking with RCP to develop web app communication
Next Topic:Removing contribution from the plugin
Goto Forum:
  


Current Time: Sat Apr 20 00:07:07 GMT 2024

Powered by FUDForum. Page generated in 0.02947 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top