Kalde en applet gennem aspx
Jeg har lavet et lille java-spil i Netbeans. Nu vil jeg gerne give adgang til java-spillet gennem en applet i i aspx-side i Visual Studio 2008.Jeg har lavet en jar-fil bestående af alle de nødvendige java-class-filer samt af en manifest-fil, som indeholder linien "Main-Class: Collision.class".
Aspx-siden indeholder dette script til at vise spillet:
<script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = { code:'components.Collision', width:300, height:300} ;
var parameters = {jnlp_href: '\\JavaSpil\\javaspil.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
Men når jeg forsøger at vise siden med spillet på, kommer denne fejl i Java Console:
exception: JNLP file error: \JavaSpil\javaspil.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct..
java.io.FileNotFoundException: JNLP file error: \JavaSpil\javaspil.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct.
at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.io.FileNotFoundException: JNLP file error: \JavaSpil\javaspil.jnlp. Please make sure the file exists and check if "codebase" and "href" in the JNLP file are correct.
Jeg har også prøvet at få diverse andre fejl, men det skyldes nok, at jeg ikke havde kaldt java-filen korrekt.
Min JavaSpil.jnlp ser således ud:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>JavaSpil</title>
<vendor>JavaSpil</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.6+"
href="http://java.sun.com/products/autodl/j2se" />
<jar href="javaspil.jar" main="true" />
</resources>
<applet-desc
name="JavaSpil"
main-class="components.Collision"
width="300"
height="300">
</applet-desc>
<update check="background"/>
</jnlp>
Er der nogle, som kan hjælpe mig med dette lille problem?