I'm a newbie to Java Card technology, and I just started reading about it. I want to create a smart applet for my card. My goal is for it to work on card used contactlessly. I downloaded jar file (GlobalPlatformPro) to install *.cap file on card using NFC Card Reader ACR122. But unfortunately I got an error:
Exception in thread "main" java.lang.IllegalArgumentException: apdu must be at least 2 bytes long
at javax.smartcardio.ResponseAPDU.check(ResponseAPDU.java:73)
at javax.smartcardio.ResponseAPDU.<init>(ResponseAPDU.java:67)
at sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:91)
at pro.javacard.gp.GlobalPlatform.select(GlobalPlatform.java:203)
at pro.javacard.gp.GPTool.main(GPTool.java:334)
My first question is, is it possible to write an applet using this reader? And secondly how you would recommend doing this?
The problem is you are trying to upload an applet to a card, which does not support Global Platform nor Java Card. Mifare 1K is a simple data storage, it can hold some data you write in using its proprietary API. It cannot run any applets, this card is not "smart".
The error message says the response APDU is shorter than expected. Mifare responses do not follow ISO7816, the response status consists of just one byte only, although ISO7816 expects at least two byte long status word.
Look for another card. It should support JCOP, that is the keyword to search.