I am extremely new to Java Card programming. While using javax.Smartcardio in my code, I am getting an error while trying to connect to Gemalto PCSC Java card.
i
Check junit test for more example
jnasmartcardio
For example I did as follows and manages to detect whether the SMARTCART is connected.
public class Prueba {
public static void main(String[] args) throws Exception
{
TerminalFactory context;
Security.addProvider(new Smartcardio());
context = TerminalFactory.getInstance("PC/SC", null, Smartcardio.PROVIDER_NAME);
// Display the list of terminals
List<CardTerminal> terminals_list = context.terminals().list();
if (terminals_list.isEmpty())
{
System.err.println("No existen dispositivos conectados...");
return;
}
// Use the first terminal
CardTerminal terminal = terminals_list.get(0);
if (terminal.isCardPresent())
{
System.out.println("La tarjeta electronica esta presente!: "+terminal.getName());
}
else
{
System.out.println("La tarjeta electronica NO esta presente");
}
}
}
}