title: How to send the APDU command to get a success response?
body: <p>I have this method in my javacard applet:</p>
  
  <pre><code> public void process(APDU apdu)  
  {
    byte[] buf = apdu.getBuffer() ;  
    switch(buf[ISO7816.OFFSET_INS])  
     { 
     case 0x40: 
                Util.arrayCopy(hello,(byte)0,buf,ISO7816.OFFSET_CDATA,(byte)5); 
                apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA,(byte)5); 
                break; 
  
     default:  ISOException.throwIt(ISO7816.SW_WRONG_INS) ;  
     }
  }
  </code></pre>
  
  <p>Here hello is :</p>
  
  <pre><code> private final static byte[] hello =  {0x48, 0x65, 0x6c, 0x6c, 0x6f }; 
  </code></pre>
  
  <p>and  I am sending the command in the script as follows:</p>
  
  <pre><code> powerup;
  
  // Select the installer applet
  0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
  
  // create TestApplet applet
  0x80 0xB8 0x00 0x00 0xd 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x00 0x7F;
  
  //show hello message
  0x40 0x00 0x00 0x00;  //this is the command mentioned in tutorial which gave error
  
  powerdown;
  </code></pre>
  
  <p>The first two commands are succeeded, but the last one gets the error as the command is not in correct format .</p>
  
  <p>I also tried this command:</p>
  
  <pre><code>     0x00 0x40 0x00 0x00 0x00 0x7f; 
  </code></pre>
  
  <p>But it gave me the response <code>6d00</code> which means <code>INS</code> vlaue not supported.</p>
  
  <p>Here is the actual Response:</p>
  
  <pre><code>CLA: 80, INS:40, P1:00,P2:00,Lc:00,Le:00,SW1:6d,SW2:00
  </code></pre>
  
  <p>The expected response is to get the hello value along with the success reponse <code>9000</code></p>
  
  <p>I am following the <a href="http://javacard.vetilles.com/2006/09/17/hello-world-smart-card/" rel="nofollow">tutorial</a></p>
  
  <p>What is the proper way to give the APDU command ?</p>