Announce two new product: SmartCard Reader Rockey200 and USB2.0 Extension Cable

ROCKEY 200 is a handy and portable USB Smart Card reader that can perform read/write operations on any ISO 7816-1/2/3/4 smart cards which are compatible with protocol T=0 and T=1.

USB2.0 Extension Cable With high speed USB 2.0 devices such as USB token ,USB Card Reader and so on.

Come to try it now!

How to throw an exception in my applet

Applets Development Guide

Moderator: product

CarCard
Posts: 1
Joined: Thu May 10, 2018 5:30 am
Points: 14
Contact:

How to throw an exception in my applet

Postby CarCard » Thu May 10, 2018 5:35 am

Hi, everyone

I'm learning to write Java Card Applet.

I want to throw an exception when the program execution error occurs, How to write the code in my applet?

Can anyone help me?

Garfield
Posts: 2
Joined: Thu Sep 22, 2016 4:15 am
Points: 30
Contact:

Re: How to throw an exception in my applet

Postby Garfield » Tue Jun 12, 2018 3:10 am

There is a special function for exception handling in class "ISOException":
public static void throwIt(short sw)
{}
you could use it.
Firstly, you need to import the class "ISOException" in your Applet by using the command below:
"import javacard.framework.ISOException;"
next step, call the function when you need,such as:
if(condition == false)
{
ISOException.throwIt((short)0x6F00);
}

Hope it helps you.


Return to “Applets Development Guide”

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer