Page 1 of 1

Difference between normal applet and remote applet in Java Card?

Posted: Mon Feb 18, 2019 5:37 am
by Charlotte
What's the difference between normal applet and remote applet in Java Card?
Is there some demo for the remote applet?

Re: Difference between normal applet and remote applet in Java Card?

Posted: Thu Feb 21, 2019 1:17 am
by Tolice
Java.rmi defines the Remote interface and RemoteException classes. It includes support for Remote Method Invocation (RMI) to simplify migration and integration with devices using Java Card technology.

To call Remote Interface, the first step in creating a remote service is to define its visible behavior. The remote interfaces define the services your applet provides. As in standard J2SE RMI, all Java Card RMI remote interfaces must extend the java.rmi.Remote interface. To illustrate, here is a remote interface that exposes a method to get the balance stored in the card:

Code: Select all

    import java.rmi.*;
    import javacard.framework.*;

    public interface MyRemoteInterface extends Remote {
        ...  
        public short getBalance() throws RemoteException;
        ...
        // A complete credit card application would also define other  
        // methods such as credit() and debit() methods.
        ...
    }
MyRemoteInterface defines the remote methods, in our example a getBalance() method, to retrieve the balance that is stored in the smart card. Note that except for the Java Card-specific imports, this remote interface looks exactly like a standard RMI remote interface.