Is it possible to force cache clearing when a java web start application is updated?
Asked Answered
I

3

6

Is it possible to force cache clearing when a java web start application is updated from the command line?

Iatrochemistry answered 28/9, 2010 at 11:14 Comment(1)
which "cache" do you want to clear?Kilan
I
0

Currently there is no way to clear the cache from inside the running application, or at least I was not able to find one.

Iatrochemistry answered 8/11, 2011 at 12:51 Comment(0)
F
5

Personally, I'd disable the caching while developing.

Windows: - Go go ControlPanel / Java

Linux: - $JAVA_HOME/bin/jcontrol

-> Temporary Internet Files -> Settings -> Untick "Keep temporary files on my computer"

Click on "Delete files" to clear all cache while you at it.

Frances answered 6/11, 2011 at 8:3 Comment(0)
P
3

According to the Javaws documentation, you can clear the cache with:

javaws -uninstall

or

javaws -uninstall <jnlp>

However, almost by definition, you don't need to clear the cache if the application is being updated. It just seems that sometimes Javaws doesn't update applications.

I've resorted to checking a URL where I store the 'latest version' of my app. When the app starts, I fetch the URL and compare with the running version. If they differ, I popup a "There's a new version available - update now?" message box.

If the user selects to update, I use (with appropriate exception handling not shown):

String uri = "http://www.myserver.com/path/to/myjnlp.jnlp";
String proc = "javaws";
Process javaws = new ProcessBuilder("javaws", uri).start();
System.exit(0);

So far that seems to be enough, but if necessary, I could preface the javaws with:

Process uninstall = new ProcessBuilder("javaws", "-uninstall", uri).start();
uninstall.waitFor();

The only downside of this is that, if you have Desktop links, the user will be prompted to add those again. But that's a small price to pay to have updating actually working...

Poston answered 12/10, 2012 at 1:9 Comment(0)
I
0

Currently there is no way to clear the cache from inside the running application, or at least I was not able to find one.

Iatrochemistry answered 8/11, 2011 at 12:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.