Tuesday, January 12, 2010

How to launch eclipse application from a webpage ?

We can launch 'Sample Applications' from a Splash Screen.

Reference : http://www.eclipse.org/swt/jws/
Courtesy : http://help.eclipse.org/galileo/index.jsp

Platform Plug-in Developer Guide > Programmer's Guide > Packaging and delivering Eclipse based products
Deploying eclipse based application with Java Web Start
Applications built on Eclipse can be deployed using Java Web Start.

Java Web Start "is an application-deployment technology that gives you the power to launch full-featured applications with a single click from your web browser".

The prerequisites to start eclipse from Java Web Start are:

The deployed application must be based on Eclipse 3.1 or later;
All deployed plug-ins must be jar'ed;
All plug-ins must be signed since the application needs full permission from the client.
The following steps describe how to setup a Java Web Start site serving up a feature based RCP application. These steps are for applications based on eclipse 3.3. Instructions on how to achieve the same for eclipse 3.1 and 3.2 can respectively be found in the 3.1 and 3.2 SDKs.
Step 1, creating a wrapper feature
Create a feature including all the features that are listed in your product definition;
Ensure that the org.eclipse.equinox.launcher plug-in is in the feature or in one of the included feature;
Step 2, exporting the wrapper feature
Note. Before proceeding with this step make sure to have a key store available. Eclipse does not provide any facility to create key stores. You can use the keytool application that comes with the JDK. In addition, ensure that the eclipse you are developing with is running on a Java SDK instead of a JRE. If this constraint is not satisfied, the jar signing will fail.
Select the wrapper feature and do File > Export > Plug-in Development > Deployable Features. In the wizard, select the wrapper feature, choose the "directory" option to export your JNLP application to, and check the option "package features and plug-ins as individual JAR archives". On the next page of the wizard, fill in the information relative to your key store in the "Signing JAR Archives" section. Then in the "JNLP section", enter the name of the server that will serve up your application and the level of JRE required to start your application. That last value will be used to in the generated JNLP files to fill in the value of . Click finish.
Once the export is done you should have the following structure on disk
site/ (The root of your jnlp site)
Step 3, creating the main JNLP file
A Java Web Start application is described by JNLP files. They replace the eclipse.exe and the config.ini files by some equivalent mechanism. For example, JNLP has its own mechanism to control splash screen, ways to pass parameters and define what constitutes the application.

When you did the export, all the simple JNLP files have been created, so you are left with writing the main file that will control the application. Because the majority of the main file is common to all applications, it is recommended to start from the following self documented template.

On the site serving up your application, the file must be located at the root. Once you will be done editing this file, your application will be ready.

My company

This is a mail client


Tip: once you have created this file, you can store it in the wrapper feature in a folder such that on every export you will get the complete structure. This folder needs to be referenced from the root property of the build.properties (e.g: root=/).

Plug-ins based application
Even though your RCP application does not use features, Java Web Start-ing it is possible.

To do so, it is recommended to create a wrapper feature in order to facilitate the creation of the main jnlp file and ease the deployment. This wrapper feature will list all the plug-ins of your application. Once the feature has been updated copy the generated JNLP file and modify it to become your main JNLP file.

Java Web Start on linux
When an eclipse application is started with Web Start on Linux the default windowing system is motif. If you want to run GTK, you need to set the property osgi.ws to "gtk" in the main jnlp file. For example you can add:

Known limitations
Eclipse Update and Java Web Start
Those two deployment technologies can work together under the following restrictions: plug-ins installed by Java Web Start can not be updated by Update and vice-versa. Features and plug-ins installed by Java Web Start can't be referred in the prerequisites of features that needs to be installed by Update;
Request to exit the application with a restart code are ignored;
On the Mac, you can only use Web Start with Java 1.5 or later.

No comments: