==== 8.4.1 SELECT FILE Command ==== [[8._Remote_Method_Invocation_Service| TABLE 8-1]] lists the formats required for the Select command for an RMI-based applet. Note - (%b) indicates binary notation using bit numbering as in the ISO 7816 specification. The most significant bit is b8. The least significant bit is b1. An "x" notation represents a "don't care". Field Value Description CLA **%b000000cc** or %b**0100dddd** The **cc** in bits (b2,b1) denote the origin logical channels number in the range 0-3. The **dddd** in bits (b4-b1) denote the origin logical channel number 4-19 using **0** origin notation. See [[4._Logical_Channels_and_Applet_Selection| TABLE 4-1]] for CLA field encoding format. INS 0xA4 SELECT FILE P1 0x04 Select by AID P2 %b000x00xx Return FCI information. The bits (b2,b1) are used for partial selection, if supported. If bit b5 is 1, the remote reference descriptor uses the **remote_ref_with_interfaces** format, otherwise it uses the alternate **remote_ref_with_class** format. Lc **//Lc//** Length of the AID Data **//AID//** AID of the applet to be selected (between 5 and 16 bytes) Following is the format of the response. Note that the applet may extend the format to include additional information, if necessary before sending the response back to the CAD. The additional information must retain the TLV format and must not introduce any additional information under the **jc_rmi_data_tag**. The **jc_rmi_data_length** item is the combined length in bytes of the **version** item, **invoke_ins** item and the **initial_ref** item. The **application_data_length** item is **jc_rmi_data_length + 2**. The **fci_length** item is **application_data_length + 2**. The response data includes **invoke_ins**, the instruction byte to use in the method invocation command. It also includes **initial_ref**, the initial remote object reference descriptor. The **initial_ref** item corresponds to the remote object designated as the initial reference to the **RMIService** instance during construction. The **initial_ref** item can be a normal_ref_response item described in [[8.3.5.1_Normal Response Encoding| Section 8.3.5.1, Normal Response Encoding]] or a **null** representation using a **normal_null_response** item described in that same section, if the initial remote reference object is not enabled for remote access. Also, note that if an error occurs during the marshalling of the initial remote reference descriptor, an error response is returned in **initial_ref** instead of using the error_response item format described in [[8.3.5.3_Error Response Encoding| Section 8.3.5.3, Error Response Encoding]]. Note - Even though the **select_response** structure uses the C-like "union" notation, the lengths of the alternate representations within the union do not use any padding to normalize their lengths. The format of the **remote_ref_descriptor** to be used in this response as well as all subsequent responses (**remote_ref_with_class** or **remote_ref_with_interfaces**) is determined by the value of the P2 byte of the SELECT FILE command. Note - Only the **RMIService** instance that processes the SELECT FILE command sets (or changes) the format of the remote object reference descriptor based on the value of the P2 byte. Once set or changed, the **RMIService** instance uses only that format in all Java Card RMI responses it generates.