|
|
|
|
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 |
Marcel Austenfeld 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 #1699825 is a reply to message #1636512] |
Fri, 26 June 2015 21:48 |
Jim Klo 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 |
Marcel Austenfeld 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03665 seconds