I’m trying to deploy the “texteditor-applet” example on this page: http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/usingJNLPAPI.html on Glassfish.
I made TextApplet.war, it deploys fine, but when accessed on my localhost I get this error:
FialedDownload Exception Unable to load resource:
http://localhost:8080/TextApplet/applet_JNLP_API.jar
GlassFish is running fine, this is the TextApplet.war structure:
-index.html
-texteditor-applet(JNLP): archive
-WEB-INF:
|--web.xml
index.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-US">
<head>
<title>Text Editor Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<noscript>
A browser with JavaScript enabled is required for this page to operate properly.
</noscript>
<h1>Text Editor Applet Demo</h1>
<p>Click the Open button and open a plain text file.</p>
<p>Edit the text and click the Save button</p>
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { code:'TextEditorApplet.class', archive:'applet_JNLP_API.jar', width:500, height:300} ;
var parameters = {jnlp_href: 'texteditor-applet.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
I even tried this: notice the difference at:
var parameters = {jnlp_href: 'http://localhost:8080/TextApplet/texteditor-applet.jnlp'} ;
index.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-US">
<head>
<title>Text Editor Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<noscript>
A browser with JavaScript enabled is required for this page to operate properly.
</noscript>
<h1>Text Editor Applet Demo</h1>
<p>Click the Open button and open a plain text file.</p>
<p>Edit the text and click the Save button</p>
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { code:'TextEditorApplet.class', archive:'applet_JNLP_API.jar', width:500, height:300} ;
var parameters = {jnlp_href: 'http://localhost:8080/TextApplet/texteditor-applet.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
</web-app>
Can someone tell me why I am getting that error? Maybe something wrong with web.xml, I don’t know just guessing.
I got the solution to this problem. Looks like “applet_JNLP_API.jar” is missing from the package downloaded from this linke: http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/examplesIndex.html#AppletJNLPAPI
I found it here:
http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/examples/dist/applet_JNLP_API/AppletPage.html
added it to my project and works fine, Thank You.