Java Card Applet内部能否自主发送并执行APDU命令?
Short answer: Nope, a Java Card Applet can’t independently send APDU commands and fetch responses—the platform’s architecture just doesn’t support this kind of "initiative" behavior.
Let me break this down for you:
- Java Card works on a terminal-driven model. The card (and all its applets) sit idle until a terminal (like a card reader or smartphone) sends an APDU command. Only then does the target applet’s
process(APDU apdu)method wake up to handle the request and send back a response. - There’s no built-in API (like the hypothetical
SomeAPI.someMethod()in your code snippet) that lets an applet generate and dispatch its own APDU commands. TheAPDUobject passed toprocess()is strictly for two things: reading the incoming terminal command, and writing your response back to the terminal.
What about talking to other applets on the same card?
If you need to interact with another applet on the same card, that’s doable—but not via APDUs. Instead, you use Java Card’s Shareable Interface system:
- Create a shared interface that the applet you want to talk to implements.
- Use
JCSystem.getAppletShareableInterfaceObject()to grab a reference to that interface from your applet. - Call methods directly on the interface—this is a direct code-level interaction, not an APDU exchange.
How to get "active-like" behavior if you need it?
If you’re thinking of a workflow where the applet seems to trigger an action on its own, you have to structure it as a multi-step back-and-forth with the terminal:
- The terminal sends an initial APDU to kick off the applet’s logic.
- The applet returns a response saying it needs more input or a specific action from the terminal.
- The terminal sends follow-up APDUs to move the workflow forward.
This gives the impression the applet is "initiating" something, but every step is still driven by the terminal sending an APDU first.
内容的提问来源于stack exchange,提问作者SmInc

