The exclusive promotional activities on JCOP J3H145 card and Feitian R301 Smartcard Reader are in full swing. Please check this page for details.

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

Post by 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 :46

Re: How to throw an exception in my applet

Post by 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.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer