它给了我这个错误。
MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
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.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:744)
Error while initializing manager: MissingFieldException[ The following required field is missing from the launch file: <jnlp>], bail out
对我来说更奇怪的是它有效如果我手动打开html文件,但如果我在我的django应用程序中使用此文件则无效。
所有文件均已在IDEA 13 comminity edition
中创建<html><head>
<SCRIPT src="http://java.com/js/dtjava.js"></SCRIPT>
<script>
function launchApplication(jnlpfile) {
dtjava.launch( {
url : 'Duplicate.jnlp'
},
{
javafx : '2.2+'
},
{}
);
return false;
}
</script>
<script>
function javafxEmbed_Duplicate_id() {
dtjava.embed(
{
id : 'Duplicate_id',
url : 'Duplicate.jnlp',
placeholder : 'javafx-app-placeholder',
width : 600,
height : 400
},
{
javafx : '2.2+'
},
{}
);
}
<!-- Embed FX application into web page once page is loaded -->
dtjava.addOnloadCallback(javafxEmbed_Duplicate_id);
</script>
</head><body>
<h2>Test page for <b>Duplicate</b></h2>
<b>Webstart:</b> <a href='Duplicate.jnlp' onclick="return launchApplication('Duplicate.jnlp');">click to launch this app as webstart</a><br><hr><br>
<!-- Applet will be inserted here -->
<div id='javafx-app-placeholder'></div>
</body></html>
那是html文件。
这是jnlp文件
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="Duplicate.jnlp">
<information>
<title>Title</title>
<vendor>vendor</vendor>
<description>dfsdf</description>
<offline-allowed/>
</information>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Duplicate.jar" size="24699" download="eager" />
<jar href="commons-codec-1.6.jar" size="232771" download="eager" />
<jar href="commons-logging-1.1.3.jar" size="62050" download="eager" />
<jar href="fluent-hc-4.3.3.jar" size="28696" download="eager" />
<jar href="gson-2.2.4.jar" size="190418" download="eager" />
<jar href="httpasyncclient-4.0.1.jar" size="157516" download="eager" />
<jar href="httpasyncclient-cache-4.0.1.jar" size="33811" download="eager" />
<jar href="httpclient-4.3.3.jar" size="589512" download="eager" />
<jar href="httpclient-cache-4.3.3.jar" size="149800" download="eager" />
<jar href="httpcore-4.3.2.jar" size="282269" download="eager" />
<jar href="httpcore-nio-4.3.2.jar" size="316524" download="eager" />
<jar href="httpmime-4.3.3.jar" size="37274" download="eager" />
<jar href="jfxutils-0.3.jar" size="30866" download="eager" />
<jar href="org.json-20120521.jar" size="40375" download="eager" />
<jar href="unirest-java-1.3.8.jar" size="35161" download="eager" />
</resources>
<applet-desc width="600" height="400" main-class="com.javafx.main.NoJavaFXFallback" name="Duplicate" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="600" height="400" main-class="sample.Main" name="Duplicate" />
<update check="background"/>
</jnlp>
那是返回html的django视图
def chart(request):
html = open('Duplicate.html')
return HttpResponse(html)