Hi All,
I am new to work on JNLP program. I have created a SWING program, JNLP file when i deploy the ear file i am getting 404 error. Please find the steps in details.
1. Created a dynamic web project JWStartProject in eclipse
2. Create a HelloWorld.java class under default package.
import javax.swing.*;
public class HelloWorld extends JFrame {
private static final long serialVersionUID = 4968624166243565348L;
private JLabel label = new JLabel("Hello Java Web START!");
public HelloWorld() {
super("Jave Web Start Example");
this.setSize(350, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setLayout(null);
}
public void addButtons() {
label.setSize(200, 30);
label.setLocation(80, 50);
this.getContentPane().add(label);
}
public static void main(String[] args) {
HelloWorld exp = new HelloWorld();
exp.addButtons();
exp.setVisible(true);
}
}
3. Run the HelloWorld.java and tested the result.
4. Now exported HelloWorld.jar and signed HelloWorld.jar using KeyStore
5. Added signed HelloWorld.jar under WEB-INF folder
6. Now I created HelloWorld.jnlp and placed under WEB-INF folder
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="https://127.92.92.1:9043/JWStartProject/"
href="HelloWorld.jnlp">
<information>
<title>HelloWorld</title>
<vendor>IBM - JWS example of HelloWorld</vendor>
<description>HelloWorld - Example of JWS</description>
<description kind="short">HelloWorld example</description>
<offline-allowed/>
</information>
<resources>
<j2se version="1.6+"/>
<jar href="HelloWorld.jar"/>
</resources>
<application-desc main-class="HelloWorld"/>
</jnlp>
7. Now I created Index.html and placed under WEB-INF folder
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD>
<TITLE>index.html</TITLE>
</HEAD>
<BODY>
<A href="HelloWorld.jnlp">Launch HelloWorld using JWS</A>
</BODY>
</HTML>
8. web.xml contains following code.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>JWStartProject</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>JnlpDownloadServlet</servlet-name>
<servlet-class>com.sun.javaws.servlet.JnlpDownloadServlet</servlet-class>
<init-param>
<param-name> logLevel </param-name>
<param-value> DEBUG </param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JnlpDownloadServlet</servlet-name>
<url-pattern>*.jnlp</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>jnlp</extension>
<mime-type>application/x-java-jnlp-file</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jar</extension>
<mime-type>application/java-archive</mime-type>
</mime-mapping>
</web-app>
9. Now I exported this project as JWStartProject.war contains following code.
10. Created Server in Websphere Admin console
11. Deployed this war file under the server and started.
12. I have added MIME types also.
I am unable to launch the application. I am getting 404 errors. May I know where I went wrong?
Regards
Victor.