我正在使用附加的 jnlp 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="1.6+" version="1.0.7" codebase="http://localhost:8080/weasis/images" href="viewer.jnlp?username=<%=request.getParameter("username")%>">
<information>
<title>Weasis</title>
<vendor>Hôpitaux Universitaires de Genève (HUG)</vendor>
<homepage href="docs/help.html"/>
<description>DICOM images viewer</description>
<description kind="short">An application to visualize and analyze DICOM images.</description>
<description kind="one-line">DICOM images viewer</description>
<description kind="tooltip">Weasis</description>
<icon href="images/logo-button.png" kind="default" />
<icon href="images/about.png" kind="splash" />
<shortcut online="false">
<desktop/>
<menu submenu="Weasis"/>
</shortcut>
</information>
<security>
<all-permissions/>
</security>
<resources>
<!-- Requires Java SE 6 update 10 release for jnlp extension without codebase (substance.jnlp) -->
<j2se version="1.6.0_10+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="128m" max-heap-size="512m" />
<j2se version="1.6.0_10+" initial-heap-size="128m" max-heap-size="512m" />
<!-- Weasis launcher -->
<jar href="weasis-launcher.jar" main="true" />
<!-- OSGI Felix framework -->
<jar href="felix.jar" />
<!-- Optional library (Substance Look and feel, only since version 1.0.8). Requires the new Java Plug-in introduced in the Java SE 6 update 10 release.For previous JRE 6, substance.jnlp needs a static codebase URL -->
<extension href="substance.jnlp"/>
<!-- Allows to get files in pack200 compression, only available from Weasis 1.1.2 -->
<property name="jnlp.packEnabled" value="true" />
<!-- Required parameter. Define the location of config.properties (the OSGI configuration and the list of plug-ins to install/start) -->
<property name="felix.config.properties" value="http://localhost:8080/weasis/conf/config.properties" />
<!-- Required parameter. Define the code base of Weasis for the JNLP -->
<property name="weasis.codebase.url" value="http://localhost:8080/weasis" />
<!-- Required parameter. Start OSGI console on the port 17179 -->
<property name="gosh.args" value="-sc telnetd -p 17179 start" />
<!-- Optional parameter. Allows to have the Weasis menu bar in the top bar on Mac OS X (works only with the native Aqua look and feel) -->
<property name="apple.laf.useScreenMenuBar" value="true" />
<!-- Optional parameter. Allows to get plug-ins translations -->
<property name="weasis.i18n" value="http://localhost:8080/weasis-i18n" />
<!-- Optional Weasis Documentation, appears in the menu Help > User Manual -->
<!-- <property name="weasis.help.url" value="http://localhost:8080/weasis-doc" /> -->
</resources>
<!-- Main class -->
<application-desc main-class="org.weasis.launcher.WebstartLauncher">
<argument>$dicom:get -l "<%=request.getParameter("username")%>"</argument>
</application-desc>
</jnlp>
当我从 jsp web 项目运行 jnlp 文件时,使用 url 的页面:查看器是我的 jnlp 文件。
http://localhost:8080/Deleteasap/viewer.jnlp?username=lop
jnlp 文件下载并给出此异常:
MissingFieldException[ The following required field is missing from the launch file: <jnlp>(<application-desc>|<applet-desc>|<installer-desc>|<component-desc>)]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
如果我做错了,请告诉我该怎么做。谢谢