I have built an JNLP (Java Web Start) application to FTP files to different remote servers. Here are the problems I have encountered while building and launching my application.
- JNLP Security.
Applications launched with Java Web Start will, by default, run in a restricted environment with limited access to files and network.To override this default behavior you have to sign JAR files. A signed application can request additional system privileges, such as access to a local disk. You do not need to sign all your jars, just the ones which operate outside your restricted environment (‘sandbox’). While signing JNLP application, you might encounter the following error:’jarsigner: unable to sign jar:…’.
In this case you can use ‘brute force’ – unjar jars which you want to sign, remove manifest file from these jars and jar them again. You will be able to sign these jars with your signature.
- edtFTPj/PRO in your JNLP application
edtFTPj/PRO requires license information, which is supplied as either two strings (an owner string and license key), or as a license.jar file (for trial editions and for customers prior to 2.0.1). When you start your JNLP application, you might have ‘license.jar not found’ exception. This exception is misleading, it is thrown even if you have non-trial edition of edtFTPj/PRO.
You have to include license information in your main class:
com.enterprisedt.util.liccense.License.setLicenseDetails
(“yourownername”, “yourlicensekey”);
- JNLP configuration:
In order to launch your JNLP application from jsp you have to include the following configuration in your jsp page:
<?xml version=”1.0″ encoding=”utf-8″?>
<jnlp spec=”1.5+” codebase=”<%=jnlpCodeBase %>”>
<information>
<title>Uploader Application</title>
<vendor></vendor>
<homepage href=”yourhomepage.otp”/>
<description>Uploader Application</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version=”1.5+” java-vm-args=”-Xnoclassgc”/>
<!– your jnlp application jar –>
<jar href=”<%=jnlpCodeBase%>/approot/app.jar” download=”eager” />
<jar href=”<%=jnlpCodeBase%>/lib/edtftpj-pro.jar” download=”eager”/>
<jar href=”<%=jnlpCodeBase%>/lib/JSAP-2.1.jar” download=”eager”/>
<jar href=”<%=jnlpCodeBase%>/lib/swing-layout-1.0.jar” download=”eager”/>
<jar href=”<%=jnlpCodeBase%>/lib/swing-worker.jar” download=”eager”/>
</resources>
<application-desc main-class=”yourpackage.Main”>
<argument>–server</argument>
<argument> <%=server %></argument>
<argument>–user</argument>
<argument> <%=userid %></argument></application-desc>
</jnlp>
Please note security section, it will allow your JNLP application to have full access to a client system if all its JAR files are signed.
