java web start 应用程序更新时是否可以强制清除缓存?

发布于 2024-09-24 21:47:29 字数 45 浏览 3 评论 0原文

从命令行更新 java web start 应用程序时是否可以强制清除缓存?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

木緿 2024-10-01 21:47:29

就我个人而言,我会在开发时禁用缓存。

视窗:
- 转到控制面板/Java

Linux:
- $JAVA_HOME/bin/jcontrol

->临时 Internet 文件 ->设置->取消选中“在我的计算机上保留临时文件”

单击“删除文件”以清除所有缓存。

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.

小巷里的女流氓 2024-10-01 21:47:29

根据Javaws文档,可以清楚缓存:

javaws -uninstall

javaws -uninstall <jnlp>

但是,几乎根据定义,如果应用程序正在更新,您不需要清除缓存。只是有时 Javaws 似乎不更新应用程序。

我已采取检查存储应用程序“最新版本”的 URL。当应用程序启动时,我会获取 URL 并与正在运行的版本进行比较。如果它们不同,我会弹出“有新版本可用 - 现在更新吗?”消息框。

如果用户选择更新,我使用(未显示适当的异常处理):

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

到目前为止,这似乎足够了,但如果有必要,我可以在 javaws 前面加上:

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

唯一的缺点是,如果您有桌面链接,系统将提示用户再次添加这些内容。但这只是让更新真正发挥作用所付出的很小的代价......

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

洋洋洒洒 2024-10-01 21:47:29

目前还没有办法从正在运行的应用程序内部清除缓存,或者至少我找不到一个。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文