现在,您可以使用 Java Web Start 来部署基于 Eclipse 3.1 构建的应用程序。
Java Web Start 是“一种应用程序部署技术,它使您能够通过 Web 浏览器中的一次单击来启动功能全面的应用程序”。
从 Java Web Start 中启动 Eclipse 的先决条件是:
root=<folderContainingStartup.jar>/
<j2se version="1.4+" />
的值。单击“完成”。
site/ (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
...
Java Web Start 应用程序是由 JNLP 文件描述的。它们替换了某些等同机制中使用的 eclipse.exe 和 config.ini 文件。例如,JNLP 提供了它自己的机制来控制闪屏和参数传递方式并定义了应用程序的组成内容。
在您以前执行导出时,所有的简单 JNLP 文件都已创建好了,因此您只需编写用于控制应用程序的主文件。由于主文件中的大部分内容对于所有应用程序来说都是共同的,因此建议您从以下自述模板入手。
在为应用程序提供服务的站点上,该文件必须位于 startup.jar 所在的文件夹中。一旦您完成编辑此文件,应用程序就已经就绪了。
<?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 consituting the application -->
<!-- Here we are refering to the wrappering feature since it transitively refers to all the other plug-ins necessary -->
<extension
name="Wrappering 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>
技巧:创建此文件后,您可以将其存储到包装功能部件中 startup.jar 所在的文件夹中,以便每次导出时都能获得完整的结构。
尽管 RCP 应用程序不使用功能部件,但也可以对其应用 Java Web Start。
要完成此任务,建议您创建一个包装功能部件,以便于创建主 jnlp 文件和简化部署。这个包装功能部件将列示应用程序的所有插件。更新功能部件后,请复制生成的 JNLP 文件并对其进行修改,使其成为主 JNLP 文件。