Applications built on Eclipse can be deployed using Java Web Start.
Java Web Start è una tecnologia di distribuzione delle applicazioni che offre la possibilità di avviare applicazioni complesse con un semplice clic dal browser Web.
I prerequisiti per avviare Eclipse da Java Web Start sono:
root=<folderContainingStartup.jar>/
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. Quindi, nella "Sezione JNLP", immettere il nome del server per
l'applicazione e il livello di JRE richiesto per avviare l'applicazione. Quest'ultimo valore verrà
utilizzato nei file JNLP generati per impostare il valore <j2se version="1.4+" /> . Scegliere Fine.
site/ (la directory principale del sito JNLP)
startup.jar
features/
WrapperingFeature_1.0.0.jar
WrapperingFeature_1.0.0.jnlp
com.xyz.abc_1.0.0.jar
com.xyz.abc_1.0.0.jnlp
...
plugins/
org.eclipse.core.runtime_3.1.0.jar
com.foo.baz_1.0.0.jnlp
...
Nei file JNLP viene descritta un'applicazione Java Web Start. They replace the eclipse.exe and the config.ini files by some equivalent mechanism. Ad esempio, JNLP ha propri meccanismi di controllo della schermata iniziale, modalità di passaggio dei parametri e definizioni dell'applicazione.
Quando si esegue l'esportazione, vengono creati tutti i file JNLP semplici e l'utente deve solo scrivere il file principale che controlla l'applicazione. Dal momento che il file principale presenta molte parti comuni a tutte le applicazioni, si consiglia di iniziare con il seguente modello con documentazione incorporata.
Sul sito che gestisce l'applicazione, il file si deve trovare nella stessa cartella di startup.jar. Dopo aver modificato questo file, l'applicazione sarà pronta per l'esecuzione.
<?xml version="1.0" encoding="UTF-8"?>
<jnlp
spec="1.0+"
codebase="http://myCompany.org/jnlpServer"
href="mail.jnlp"> <!-- URL to the site containing the jnlp application. It should match the value used on export. Href, the name of this file -->
<information>
<!-- user readable name of the application -->
<title> Mail Application </title>
<!-- vendor name -->
<vendor>My company</vendor>
<!-- vendor homepage -->
<homepage href="My company website" />
<!-- product description -->
<description>This is a mail client</description>
<icon kind="splash" href="splash.gif"/>
</information>
<!--request all permissions from the application. This does not change-->
<security>
<all-permissions/>
</security>
<!-- The name of the main class to execute. This does not change-->
<application-desc main-class="org.eclipse.core.launcher.WebStartMain">
<argument>-nosplash</argument>
</application-desc>
<resources>
<!-- Reference to the startup.jar. This does not change -->
<jar href="startup.jar"/>
<!-- Reference to all the plugins and features constituting the application -->
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins necessary -->
<extension
name="Wrapper feature"
href="features/Wrappering_1.0.0.jnlp"/>
<!-- Information usually specified in the config.ini -->
<property
name="osgi.instance.area"
value="@user.home/Application Data/mail"/>
<property
name="osgi.configuration.area"
value="@user.home/Application Data/mail"/>
<!-- The id of the product to run, like found in the overview page of the product editor -->
<property
name="eclipse.product"
value="mail.product"/>
</resources>
<!-- Indicate on a platform basis which JRE to use -->
<resources os="Mac">
<j2se version="1.5+" java-vm-args="-XstartOnFirstThread"/>
</resources>
<resources os="Windows">
<j2se version="1.4+"/>
</resources>
<resources os="Linux">
<j2se version="1.4+"/>
</resources>
</jnlp>
Tip: once you have created this file, you can store it in the wrapper feature in the same folder than the startup.jar, such that on every export you will get the complete structure.
Anche se un'applicazione RCP non utilizza funzioni, è possibile usare Java Web Start.
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. Dopo aver aggiornato la funzione, copiare il file JNLP generato e modificarlo per farlo diventare il file JNLP principale.
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:
<resources os="Linux"/>
<property name="osgi.ws" value="gtk"/>
</resources>