我是JNLP的新手。 我一直试图解决这个问题直接2天......我不知道...... 我在eclipse中有一个动态的web项目。我想在html中添加一个Applet。它工作正常,如果我不使用jnlp追加它。但如果我使用jnlp,它会抛出异常...... 请帮我.... 这是我的包结构:
DaaS
DaaS\WebContent
\WebContent\AppletToJS.html
\WebContent\appletToJS.jnlp
\WebContent\FirstApplet.jar
“FirstApplet.jar”包含Applet类 - AppletToJS.java
这是我的jnlp
文件:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="appletToJS.jnlp">
<information>
<title>Dynamic Tree Demo</title>
<vendor>Dynamic Team</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="FirstApplet.jar" main="true" />
</resources>
<applet-desc
name="Applet To JS"
main-class="acid.AppletToJS"
width="300"
height="300">
</applet-desc>
<update check="background"/>
</jnlp>
这是我的html
文件:
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
<body>
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { code:"acid.AppletToJS", width:100, height:100} ;
var parameters = {jnlp_href: "appletToJS.jnlp"} ;
deployJava.runApplet(attributes, parameters, "1.6");
</script>
<!-- <applet codebase="./jars" archive="FirstApplet.jar" Code="acid.appletToJS.class" width=200 Height=100></applet> -->
<p id="summary"/>
</body>
</html>
当我运行我的html页面时,我收到了以下错误:
exception: Unable to load resource: http://localhost:8080/jars/FirstApplet.jar.
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost:8080/jars/FirstApplet.jar
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by:
java.io.FileNotFoundException: http://localhost:8080/jars/FirstApplet.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost:8080/jars/FirstApplet.jar
的http://本地主机:8080 /瓶/ FirstApplet.jar