Monday, December 12, 2016

Java Web Start (JWS) application creation, installation and execution Process

Step1:  Create a Java Application.



Step2:   Extract jar from the project.

Step3: Rename all jars for version management. Eg rename Test.jar to Test__V1.0.jar.

Step4: Compress all the jars using pack200 compression for reducing the download time.Follow below steps to do:
The following steps describe how to create and deploy a compressed JAR file for a signed RIA.
i.                    Normalize the JAR file using the --repack option.
This step ensures that the security certificate and JAR file will pass verification checks when the RIA is launched.
pack200 --repack Test__V1.0.jar
ii.                  Sign the normalized JAR file.
jarsigner -keystore myKeyStore Test__V1.0.jar me
where myKeyStore is the name of the keystore and me is the alias for the keystore.
iii.                Pack the signed JAR file
pack200 Test__V1.0.jar.pack.gz Test__V1.0.jar   
iv.                 Set the jnlp.packEnabled property to true in the RIA's JNLP file

Step5: Write a JNLP file as below: (Test.jnlp)


<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Web Start Demo -->
  <jnlp codebase="http://localhost:8080/examples/ "
  href="Test.jnlp">
            <security>
       <all-permissions/>
     </security>
    <information>
       <title>Swing Application - Test</title>
       <vendor>Sharma</vendor>
       <description>Swing Application - Test</description>
       <description kind="short">Swing Application - Test</description>
       <offline-allowed/>
              
               <shortcut online="true">
      <desktop/>
      <menu submenu="test" />
    </shortcut>
     </information>
           
     <resources>
               <j2se version="1.7+"  />
               <jar href="Test.jar" main="true" version="1.0"/>
              
                           <jar href="Hello.jar" version="1.3"/>
                           <jar href="ops.jar" version="1.0"/>
           <property name="java.home" value="C:\Program Files\Java\jdk1.8.0_101\"/>                     
               <property name="jnlp.versionEnabled" value="true"/>
           <property name="jnlp.packEnabled" value="true"/>
     </resources>
           
     <application-desc main-class="net.codejava.swing.download.Test">
                        <argument>John</argument>
                        <argument>http://<server_ip>:8080/examples/test.cfg</argument>
             </application-desc>
             
</jnlp>





Step6: Put all the jars, configuration and .jnlp file on the server.
Step7: Creating launcher which we will provide to client to launch our JWS                                            application.
             launcher.bat  (optional)
             javaws http://<IP_server>:8080/examples/Test.jnlp



Step8: When client double click on the launcher, all jars will get downloaded and a shortcut of the application will get created on his/her desktop.




     Thanks !!! Keep learning, keep sharing !!!









1 comment:

Fixing yum command on linux

You may find yourself having to fix more packages. So you can just remove everything you had installed via  pip and reinstall everythin...