It's our great honour to announce the Industry’s First VHBR CCID reader - VHBR Dual interface smart card reader vR504. It is able to support the world’s fastest ePassports.

To celebrate the new product release, there is Special Discount for New Registered Members in our store.
- Get $20.00 OFF instantly for smart card reader vR504, R502 and bR301

Come to get the readers now!

How to throw an exception in my applet

Applets Development Guide

Moderator: product

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

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?

Posts: 2
Joined: Thu Sep 22, 2016 4:15 am
Points: 42

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)

Hope it helps you.

Return to “Applets Development Guide”

Who is online

Users browsing this forum: No registered users and 0 guests

JavaCard OS : Disclaimer