重新加载时重置 Java 小程序 [英] Reset Java Applet on Reload

查看:30
本文介绍了重新加载时重置 Java 小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要退出 Firefox 并重新启动它才能刷新小程序...它很烦人,因为我仍在对它进行编程并且类文件发生了变化......我是否缺少一些代码使其无法刷新小程序并仍然从缓存中获取小程序???

I need to quit firefox and restart it in order for the applet to be refreshed... its anoying since i'm still programming it an the class files changes... am i missing some codes which makes it unable to refresh the applet and still take the one from the cache???

所以我在我的网站上有一个 .jar 小程序,一个模拟游戏,每当用户点击屏幕时就会产生军队......但是每当我刷新页面时,以前的军队仍然在屏幕上......我希望它被刷新(就像我们第一次开始运行应用程序一样).

So I have a .jar applet in my website, a simulation game that spawns army whenever user clicks on the screen... however whenever I refresh the page, the previous army are still there on the screen.. I want it to be refreshed (as if we're just starting to run the application the first time).

有什么建议吗?

我真的很感激

谢谢....

推荐答案

每次你构建一个新的 Jar 小程序时,给它添加一个内部版本号,例如 applet.jar?build=123build123/applet.jar.这也是部署的好做法,因为它消除了所有缓存问题,并且这可能可以通过您的构建解决方案简单地自动化,例如 Ant.

Each time you build a new Jar applet add a build number to it, eg applet.jar?build=123 or build123/applet.jar. This is good practice for deployment too as it removes all cache concerns and this can probably be simply automated by your build solution eg Ant.

另外值得考虑使用separate_jvm标签,详细这里.自 1.6 更新 10 起可用.它将确保每次刷新都有一个新的 JVM,从而避免您担心插件特性,例如由于大量刷新而导致的内存不足异常.

In addition it is worth considering using the separate_jvm tag, detailed here. Available since 1.6 update 10. It will ensure a new JVM each refresh which prevents you worrying about plug-in idiosyncrasies eg out of memory exceptions due to a lot of refreshes.

这篇关于重新加载时重置 Java 小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆