Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 1000
sorin Avatar asked Sep 28 '10 11:09

sorin


People also ask

How do I clear a jar cache?

In the Java Control Panel's General panel, click the Settings button and the Delete Files button. Select all the check boxes that contain references to Applications and Applets. Click OK to clear the cache. When a message indicates that the JAR cache is cleared, click OK.

How do I clear Java cache on Linux?

About this task. Launch the Java Control Panel program by running $JAVA_HOME/jre/bin/ControlPanel from a shell prompt. On the General tab, click Delete Files in the Temporary Internet Files section at the bottom of the panel. On the Delete Temporary Files window that opens, ensure that Downloaded Applets is checked.


2 Answers

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.

like image 195
Linh Avatar answered Sep 30 '22 14:09

Linh


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...

like image 26
craigmj Avatar answered Sep 30 '22 12:09

craigmj