Deploying Java Clients with Java Web Start (JWS) Christopher M. Judd President/Consultant Judd Solutions, LLC. User Interface History 1970 1980 1990 2000 Terminal Client/Server Web Mobile (Disconnected Clients) Organizations are looking for the ease of maintenance offered by the web with the rich client capabilities of client/server while enabling mobility 1
Client Deployment Options HTML Applets Third party tools Enterprise Proprietary Open Source Java Web Start Java Web Start (JWS) Reference implementation of JNLP Java TM Network Launching Protocol & API (JNLP) Java clients (Swing, AWT, SWT) Single click deployment Cross platform Application Manager Works with any browser Integrated with JRE 2
Java Launch Network Protocol (JNLP) Application launch and deployment technology Secure (sandbox) Client based (Swing, AWT, SWT) JNLP API JWS Features Multiple JREs Security Code-signing Sandboxing Versioning and incremental updates Desktop integration Offline operation Automatic installation of JREs 3
Installation Users Computer Web Server http://localhost:8080/sdc.jnlp sdc.jnlp JDK sdcclient.jar 1.0 sdcreport.jar 1.0 sdc.jnlp sdcclient.jar 1.0 sdcreport.jar 1.0 JavaSoft.com JDK Launching Methods HTML Link Installation Application Manager Shortcut 4
Updating Users Computer Web Server sdc.jnlp JDK sdcclient.jar 1.0 2.0 sdcreport.jar 1.0 sdc.jnlp sdcclient.jar 2.0 1.0 sdcreport.jar 1.0 Application Manager Launch Applications Add shortcuts Configuration Proxy Manage JREs Cache 5
*.jnlp Configuration file XML format application/x-java-jnlp-file Windows associates it with JWS JNLP Example <?xml version="1.0" encoding="utf-8"?> <jnlp codebase= http://localhost:8080" href="sdc.jnlp"> <information> <title>application Name</title> <vendor>company Name</vendor> <icon href="images/image.gif"/> <homepage href="index.html"/> <description>application Description</description> <offline-allowed/> </information> <resources> <j2se version="1.4+"/> <jar href="sdcclient.jar"/> <jar href="sdcreport.jar"/> </resources> <application-desc main-class="com.sdc.store.ui.mercuryclient"/> </jnlp> 6
Setup Install Java Web Start on all clients Now comes with JRE and JDK Add jnlp mime-type to web server application/x-java-jnlp-file jar application Create web page with link to jnlp file Deploy jars, web page and jnlp file to web server Tip for loading resources ClassLoader.getResourceAsStream Security Default (sandbox) Untrusted Limited access to network Limited access to file system Override Trusted Digitally sign code Users discretion 7
Digitally signing code Generate a Key using keytool Included in the JDK http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.h tml Ant Task to sign <signjar jar= application.jar" alias="sdc" keystore="${keystore}" storepass="${key.pass}"/> JNLP Developer s Pack Separate Download (See Resources) Contains Developer s Guide JNLP Servlet and Servlet Guide JNLP API (javax.jnlp.*) Jar diff tool JavaScript for detecting and installing JWS 8
JNLP API javax.jnlp.* Sandbox Services BasicService Access to codebase ClipboardService Set and get clipboard contents DownloadService Control resources and cache ExtensionInstallerService Interact with JNLP Client PersistanceService Store and retrieve local data JNLP Servlet Without JNLP Servlet <jnlp codebase= http://localhost:8080" href= sdc.jnlp"> </jnlp> Using JNLP Servlet <jnlp codebase="$$codebase" href= $$name"> </jnlp> Servlet Configuration <servlet> <servlet-name>jnlpdownloadservlet</servlet-name> <servlet-class>com.sun.javaws.servlet.jnlpdownloadservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>jnlpdownloadservlet</servlet-name> <url-pattern>*.jnlp</url-pattern> </servlet-mapping> 9
e-lube Open Source JNLP Clients Netx http://www.acm.vt.edu/~jmaxwell/netx/netxpa ge.html OpenJNLP http://openjnlp.nanode.org/ 10
Testing Toolkit Apollo http://ajax.sourceforge.net/apollo/ Conclusion JWS and JNLP are a simple, secure and standards based way of distributing client application over the network. 11
Resources Java Web Start and JNLP http://java.sun.com/products/javawebstart/ JNLP Developer s Pack http://java.sun.com/products/javawebstart/developers.ht ml JNLP API http://java.sun.com/j2se/1.4.2/docs/guide/jws/jnlp/index. html Contact Information http://www.juddsolutions.com cjudd@juddsolutions.com Blog http://blogs.apress.com/authors.php?author=christopher%20jud d Enterprise Java Development on a Budget http://www.apress.com/book/bookdisplay.html?bid=197 12
Questions? Please fill out evaluations!!! 13