Saturday, February 24, 2007

How to export multi-platform?

Well,
I hope that after those last two posts, you are already capable of adding your classes to your project and growing it without any further problems. Once this is done, I also expect that you can export your project and run it outside of Eclipse with no headache. You choose your deploy directory (which I'll call $DEPLOY_DIR) and you can run your executable software at $DEPLOY_DIR/yourapp(.exe). If this is not the case, feel free to contact me either by email or posting a comment.

So, now that you have your development environment set up and you can run your software in your platform, you probably want to export it into other operating systems (OS). For now, you don't even have this option anywhere you can find it. If you search a bit through the internet you'll discover you need the RCP-Delta-Pack to do so. Very good... but where the hell is that pack? If you search around the RCP download you'll eventually find it although it's not really very well exposed.

The way to find the up to date version is:
http://www.eclipse.org/downloads/
Choose "Other downloads for ..."
Get down to "RCP SDK" and the last file is the RCP delta pack.
For the 3.2.2 version, just click here.

Now that you have your delta-pack, it's really easy. Just unzip the file into $ECLIPSE_HOME/plugins and restart your eclipse. Now when you ask to export your application, you'll get a nice checkbox asking if you want to export to multiple platforms. If you select it, the "next" button will become active and if you click it, you'll have a list of supported OSs. Let's say you'll select macosx_ppc, linux_x86 and win32_x86 (like Archimedes does).
The export system will use the $DEPLOY_DIR and create in it, 3 folders (one for each system):
linux.gtk.x86
macosx.carbon.ppc
win32.win32.x86
And each of these folders will contain all files needed to run the software on these OSs with those graphical interfaces.

If you take a look, you'll find that much is common to all OSs and we hope so, since it should be a platform-independent software. I cared to take a deeper look and list what is common and what is not.
Mainly, the "configuration" and "features" folder are identical. The "plugins" is mainly identical, the only thing that may change is a couple of plugin fragments that are OS specific (like "org.eclipse.opengl.linux" and "org.eclipse.open.macosx"). If the fragments have requirements regarding the OS, they will be selected only by the OSs that support that requirements. Careful about that! If you depend on a plugin that has a fragment like that one and it doesn't get exported, you'll get the friendly "There was an error. Please check .metadata/.log for more details." message. If you check the log, you'll find the also friendly (but known already) "No application ID found" message.

The root folder, however, is quite diferent depending on the OS you look. The only file that is always available is "startup.jar" which contains the basic RCP plugin system which will activate whatever needs to be activated.
All the rest is quite diferent. For example:
Windows has only a "yourapp.exe" file.
MacOS X has a whole folder "yourapp.app" with a nice deep structure required to make your software run like a native Mac software.
Linux is the most poluated one. It has "youricon.xpm", a folder "about_files" and a page "about.html", "libcairo-swt.so" and a "yourapp" executable file.

Now why is that important? Because you will probably want to make an installer (like Archimedes does) or a common package that would allow your users to download once the core and add the OS specific files as they need it. In this case, you'll need to know what is core and what is OS specific.

I'll stay here for today but my next post will be about creating this installer. I'll use IzPack (http://www.izforge.com/izpack) to make the example because it's what Archimedes uses and it is very simple and powerful. You can probably, however, use the example in any installer you'd like just adapting the procedure.

10 comments:

Chandresh Gandhi said...

I come across situation where I need to use a eclipse SDK for each OS/platform – we do support for our RCP product -.

Now instead of using eclipse SDK for different 4-5 platforms and where they have just of around 5 MB platform dependent stuffs,

Don't we have mechanism where we can use "a eclipse SDK common to all platform" and integrate RCP delta package – containing all platform specific stuffs and respective launcher – for same purpose.

Just to make things much clarified …

here my Idea is not to use RCP delta pack for cross-platform export of out RCP product. Here It mainly plays role behind the scene – for build n deployment support for different OS/Platforms -.

rather I need to use from front as "a common eclipse distro for all platforms". It could be made of "all platform independent bundles from eclipse SDK + RCP detla pack"

as per my current knowledge , RCP delta pack is having all platform specific bundles + a launcher for each eclipse platform specific launcher. So, we can reference/calling a launcher jar from respective platforms during its usage there and it should pick-up all bundles from common eclipse + RCP detla pack according to that platform only.

Perhaps it should be treated as I have eclipse on the board for that platform. And likewise for all other platforms ….

I'm not sure whether such Ideas can be given right shape for these purposes AND how.

Any Ideas on these pls ???

Thanks,
Chandresh Gandhi (Skype chandreshgandhi).

Hugo "NighT" Corbucci said...

Hello Chandresh,
I had a hard time trying to understand what you ment so please rephrase your questions if I didn't got it.

If I understand it, you want to have a cross-platform starter for your RCP application (a .jar file I guess).

If that is the case, it is pretty simple to do since that is exactly what the executables in each platform do (run a specific jar). Search for the sourcecode of the linux eclipse executable to have the complete command line.

Concerning the RCP Delta pack. It is composed of the executable descriptions plus the platform-dependent plugins for all platforms. But it is not used in runtime! It is used in export time to generate the correct set of plugins and the correct executable for each platform.

I hope that helps, otherwise, try to make your questions a bit more clear and I'll answer again.

Friendly

Anonymous said...

Thanks for your reply …

Let me put things in still much simpler terms...

I need to use “a eclipse SDK” for specific OS/Platform. This goes to working with 4-5 diff. eclipse SDKs for our entire product supported OSs/Platforms – Windows32-64, Linux32-64, Solaris32 -.

We have observed there is big size of stuff in “a eclipse SDK” common to each OS/Platform – it raised redundancy among all such eclipse SDKs - and RCP delta pack is having platform-dependent plugins for all platforms,

Can’t we think of having “a common eclipse SDK distro for all major OSs/Platforms” anyhow and use it from the front from each platform???

Important to note here is that we can launch eclipse – in platform independent fashion - from command line using a common launcher jar
java -jar eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar

Such a distro should contain “all platforms independent components from eclipse SDK”+ a compatible RCP detla pack – this pack will serve platform specific components for all OS/Platfrom. Such a common package should be tweak accordingly.

Regards,
Chandresh Gandhi.

Anonymous said...

hello Hugo,

now bit more interesting ... as we have gained from URL,

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/launcher.html

The org.eclipse.equinox.launcher.${platform}.${version} folders are only
used by the platform specific binary launcher during start-up.

e.x. Your eclipse for Win32 contains org.eclipse.equinox.launcher.win32.win32.x86_1.0.0.v20070523 in its plugins directory for such usage only . Likewise for any platform specific eclipse ….

Launching eclipse from command line using

java –jar org.eclipse.equinox.launcher.${version}.jar
doesn't require the
org.eclipse.equinox.launcher.${platform}.${version} folder at all.

now, as you might have observed RCPDeltaPack/plugins contains org.eclipse.equinox.launcher.${platform}.${version} fragments/folders for each platforms – they are platform specific - along with other stuffs.

So, once we merge "a eclipse SDK" and "compatible RCP" delta pack and then remove org.eclipse.equinox.launcher.${platform}.${version} folders from its plugins/ directory,

Shouldn't
java -jar org.eclipse.equinox.launcher.${version}.jar
launch eclipse from all different platform perfectly - perhaps it's starting point in this direction -
(I also need to give it proper try)

How do you see these concepts n scenarios??
Any Ideas on these Pls ??

Regards,
Chandresh Gandhi
(Skype Id : chandreshgandhi)

Hugo "NighT" Corbucci said...

I am still not sure wether I understand what is your problem. Eclipse does export Rich Client Applications to each platform and it is true that this uses more disk space than it could. However, if you want to have like a single zip file for your clients, a very simple solution is to have plugins for all platforms included in your zip file and executables for each platform also. This should do the trick an allow it to be run correctly on every platform (still using more disk space than needed).

Honestly, platform specific plugins are needed for a lot of features. Running eclipse (or an RCP application) without them, will probably disable a lot of those features. If you have disk restriction on your target platform, then the best is to filter the features that you really need. If your problem is about your own build to deliver the application to the client, Eclipse can generate a ant build file that builds according to the platform you require. Search for any of those infos (or please try to state your problem again since I still don't understand it).

Libu said...

Hi

As mentioned in ur blog, I unzipped eclipse-RCP-3.3.2-delta-pack into the plugins folder and restarted eclipse. But I'm not getting any checkboxes asking whether I want to export to multiple platforms. Any idea what could be the reason?

Hugo Corbucci said...

If I am not mistaken, the RCP Delta Pack zips are now divided into two folders, plugins and features.
You must get the content of the plugins folder to your eclipse's plugins folder and the content of the features folder to the eclipse's features folder. Make sure the contents are exported in the right destination.

Friendly,
Hugo

Anonymous said...

Hello,

I got the following error message when I tried to export multi-platform:
"Unable to find plug-in:org.eclipse.equinox.lancher.gtk.linux.x86_1.1.101.R34x_V20080805"

I do have this folder in my eclipse plugin folder.

Any ideas on this problem?

Thank you so much in advance.

Hugo Corbucci said...

Hello,
You are probably facing a problem regarding your target platform. If you use your own eclipse as a target platform, it will NOT load plugins and fragments that are not being used in your system.
The solution to that is to have a fresh eclipse in some other directory with all the plugins you need that you only use as a Target Platform.

To change the Target Platform, go to your Eclipse preferences, type in 'Target' and choose the folder directory to your fresh non used eclipse directory. Then try exporting after applying those changes.

Rui Domingues said...

I'm facing that problem now in 2014.

Are you saying that I've to copy the content of delta-pack into a fresh eclipse and than add it as a target platform?

Actually I don't understant why it happens to me only in Windows.
It's awckward. In Linux everything is fine.