This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am getting the following exception when trying to run a java web start application under jre 1.6.0_01 It works fine as is under 1.5.0_11
Caused by: java.io.FileNotFoundException: \\dev\statistics\software\validation\avet-db.jar (Access is denied) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source)
The JNLP file looks like the following
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://dev/statistics/avet/software/validation" href="avet.jnlp"> <information> <title>Title</title> <vendor>Company A</vendor> <description>Description - DEVELOP</description> <offline/> </information> <security> <all-permissions/> </security> <resources os="Windows"> <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se" max-heap-size="512M"/> <nativelib href="native/avet.dll.jar"/> <nativelib href="native/avetuser32.dll.jar"/> <nativelib href="native/btree32.dll.jar"/> <jar href="avet/avet.jar"/> <jar href="avet/avet-resources.jar"/> <jar href="avet/avet-reports.jar"/> <jar href="avet/avet-config.jar"/> <jar href="avet/avet-db.jar"/> .... there are other jars here that have been removed for simplicity ... </resources> <application-desc main-class="com.comp.main.MainClass"></application-desc> </jnlp>
Well I found the answer It turns out that the code was getting a handle on one of the jar files that the application uses (avet-db.jar) and was trying to unzip the jar onto the remote machine, this was a simple way of deploying the resources in the jar file onto the remote machine.
This was possible in Java Web Start 1.5.x as the application was able to look inside the Java Web Start cache and get a file handle to a jar file in the cache. In Java Web Start 1.6.x this is no longer possible the file handle is invalid as you are no longer allowed to look inside the cache and get a file handle to a jar there.
So the answer - well the code will need to change so that the application gets the ClassLoader and uses that to get all the resources in the jar file, and then persist them to disk (ClassLoader.getResource() then save it to disk). I am also looking at the possibility of having only 1 file in the jar file that is zipped - I then persist the file to disk and unzip it there - this is a bit messy but it means that if more resources are added to the jar file later properties do not need to be changed so that the resources are obtained from the jar (using ClassLoader.getResource()) and then saved to disk.