Deleting an applet means that the applet and all of its child objects are deleted. Applet deletion fails if any of the following conditions exist:
Any object owned by the applet instance is referenced by an object owned by another applet instance on the card.
Any object owned by the applet instance is referenced from a static field in any package on the card.
The applet is active on the card.
If you are writing an applet that is deemed to be short lived and is to be removed from the card after performing some operation, follow these guidelines to ensure that the applet can be easily removed:
Write cooperating applets if shareable objects are required. To reduce coupling between applets, try to obtain shareable objects on a per-use basis.
If interdependent applets are required, make sure that these applets can be deleted simultaneously.
Follow one of the following guidelines when static reference type fields exist:
Ensure there is a mechanism available in the applet to disassociate itself from these fields before applet deletion is attempted.
Ensure that the applet instance and code can be removed from the card simultaneously (that is, by using applet and package deletion).