Gemalto is now part of the Thales Group, find out more.

You are here

Delete jar file in FFS with FileConnection API | Thales IoT Developer Community

August 24, 2017 - 9:01am, 2594 views


I want to delete a jar file by using FileConnection API (JSR75).

I want to check if file exists in FFS by using exists() method and then delete if exists.

There are 2 situations that causes different exceptions in operation.

1. If I open jar file with READ_WRITE ****, open method throws security exception that says:

java.lang.SecurityException: Application not authorized to access the restricted

2. If I open jar file with WRITE ****, open method passes successfully but exists() method throws IllegalModeException which says: Connection is write only

Is there a proper way of deleting a jar file with checking file existency without getting exception?

My simple code block is below:

String jarFile = "file:///a:/xyz.jar";

FileConnection fc = null;

try {

       //fc = (FileConnection), Connector.WRITE);

      fc = (FileConnection), Connector.READ_WRITE);

       if(fc.exists()) {




} catch (Exception e) {