Do I have to close the browser in order to refresh my Java applet?
I am just learning Java applets. When I changed my code, it doesn't update if I refresh the page, but it does when I close the entire browser and 开发者_JS百科open it again. I'm using eclipse as my IDE.
Is there some setting I'm missing? Or is the only way to do it?
You can enable the Java Console, which includes several useful commands. In particular, x: clear classloader cache
may be helpful.
c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to
Addendum: The Java Console is sometimes the only way to see certain problems early in the applet life cycle, but a hybrid approach is sometimes convenient. You can use your IDE to debug the program as an application and then deploy it as an applet or via Java Web Start.
Consider using the built-in Eclipse applet viewer.
On Windows, the shortcut is ALT-SHIFT-X, then A (or ALT-SHIFT-D to debug).
Alternatively, go to Run->Run As...->Java Applet.
This will not only let you run/debug quicker, but it will also make sure your latest changes are there, and will even allow hot replace of code (often no need to even restart the applet to apply changes).
when you change your code, you should build the application, after you should refresh full page (using Shift + F5).
精彩评论