JNLP with local codebase - how to update?
Asked Answered
D

2

7

It is legal to specify codebase like this:

<jnlp spec="6.0+"
    codebase="file:/c:/MyApp/"
    href="myapp.jnlp">

When you import this with JWS it creates desktop shortcut and the application is working.

However, one thing is very different from remote codebase. When I update those files while the application is running, it basically stops working flooded with ClassNotFoundExceptions. It seems as if JWS did not copy the jars, or copied them immediately as they are updated somehow overwriting those used by the running process.

How can I get it to work as if the files were remote? That is, copy files to cache and only check for updates on launch.

EDIT: I haven't found a way to do it and decided to go with a homebrew replacement. Along the way I found several bugs and made some observations that I summed up at http://squirrel.pl/blog/2011/11/24/java-web-start-bugs-offline-edition/. Posting it here in case it could be of any use for someone.

Damage answered 24/11, 2011 at 9:4 Comment(4)
What problem are you trying to solve with the local codebase?Hillier
That's besides the point but: Reliance on slow and fragile web-based updates, and leveraging our existing system to pump all kinds of files, installations, updates etc. to select computers.Damage
"fragile web-based updates". Just ensure that if a file is updated it gets a new URL and update the JNLP file accordingly.Sherborne
You should post your full jnlp file - the problem may be in there. However when I remember back in the days we also had lots of problems in the past using JWS and on/offline mode...Homomorphism
J
0

For making your application auto updatable you should use <update> tag.

<update check="always" policy="always"/>

And also if you want, your application may run in offline use <offline-allowed/>.
Also for giving all security permissions you need to add tag of <security>.
Add the following tags to your JNLP file.

    <information>
        <offline-allowed/> 
    </information>

    <security>
        <all-permissions/>
    </security>

    <update check="always" policy="always"/>

    <resources>
        <jar href="your-signed.jar" main="false" download="eager"/>
    </resources>   
Jorie answered 22/11, 2013 at 6:26 Comment(0)
J
-4

In our application, the codebase is:

<jnlp codebase="http://xxxx.xxx.xxx/jars"> 

and, your jar file should put in your_webapp_root_directory/jars . For testing ,you can input a url in your browser: http://xxxx.xxx.xxx/jars/xxxx.jar, if you can download the xxxx.jar file, it works.

Jessabell answered 13/12, 2011 at 1:53 Comment(1)
Sorry, but I asked specifically about local codebase. I don't think you read the question at all.Damage

© 2022 - 2024 — McMap. All rights reserved.