October 24, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Where to Start with Java Web Start

  • July 8, 2009
  • By Sridhar M S
  • Send Email »
  • More Articles »

JNLP File in Detail

The following is a typical .jnlp file that you would use for deployments:
<?xml version="1.0" encoding="utf-8"?> 
<--Demo JNLP file  -->
< jnlp 
 codebase="http://yourUrl.com//webstart" href="myApp.jnlp"> 
  <information> 
    <title>My Web Start Application</title> 
    <vendor>Vendor Name</vendor> 
    <description>Java Web Start Application</description> 
    <icon href="images/myApp.jpg"/> 
  </information> 
  <security> 
      <all-permissions/> 
  </security> 
  <resources> 
    <j2se version="1.4.2"/> 
    <jar href="jars/myApp.jar"/> 
  </resources> 
  <application-desc main-class="MyApp"/> 
</jnlp>

The contents of this file should be sufficient for you to proceed with development. The sub-elements (information, security, and resources) are self-explanatory. They respectively convey information about the application (such as the Vendor, a brief description, etc.), security restrictions, and the resources that are available to the application context for execution.

The other notable elements operate as follows:

  • The tag application-desc indicates that the main method in the class MyApp will be used to launch the application. The tag applet-desc provides support for applets.
  • The codebase attribute in the jnlp tag will use the specified value as the base. The href attribute indicates the .jnlp file to be used for this application.
  • The security element behaves similarly to the restrictions applicable to an Applet. The all-permissions element instructs the runtime to give unlimited access to the application in this context. Using this element also mandates that the JARs in this application must be signed.
  • You can also use the j2se version attribute to specify which version of the JRE will be used to execute this application. You can further enhance this attribute to have an initial heap size that the JRE will use. For example, <j2se version="1.4.2" initial-heap-size="32m"/> specifies that the application has to be launched with version 1.4.2 and have an initial heap size of 32MB. If you wanted to specify that any version of the JRE (>= 1.4.2) can be used, the syntax would be <j2se version="1.4.2+"/>. The plus sign (+) specifies that a JRE version greater than or equal to 1.4.2 can be used.
  • You use the application-desc element to specify the main class for the application. You can also pass arguments using the following attributes:
    <application-desc main-class="MyApp"> 
        <argument>argument-1</argument> 
        <argument>argument-2</argument> 
    </application-desc>





  • Page 2 of 3



    Comment and Contribute

     


    (Maximum characters: 1200). You have characters left.

     

     


    Sitemap | Contact Us

    Rocket Fuel