Getting exception while creating and reading file

Hello MicroEJ team,

I’m trying to store a file in the simulator, I am using the MicroEJ version.

… |BOARD_NAME| replace:: STM32U5G9J-DK2
… |BOARD_REVISION| replace:: MB1918-U5G9ZJQ-A02
… |RCP| replace:: MICROEJ SDK
… |VEEPORT| replace:: VEE Port
… |SIM| replace:: MICROEJ Simulator
… |CIDE| replace:: MICROEJ SDK
… |RTOS| replace:: ThreadX
… |MANUFACTURER| replace:: STMicroelectronics
… |MICROEJ_SDK_VERSION| replace:: 23.07
… |TOOLCHAIN| replace:: IAR Embedded Workbench for Arm
… |TOOLCHAIN_VER| replace:: 9.50.1

and below is a code from the foundation library that I am using and using the same configuration defined in the example below.

From this, I am getting the below exception:

Uncaught exception thrown in Feature demoapp (CN=com.is2t.feature.demoapp, OU=IS2T, O=IS2T, L=NANTES, ST=FRANCE, C=FR):
Exception in thread “com.is2t.feature.demoapp” java.lang.RuntimeException
at java.lang.Throwable.fillInStackTrace(
at java.lang.Throwable.(
at java.lang.Exception.(
at java.lang.RuntimeException.(
at com.medtronic.neuro.LandingPage.main(
at com.medtronic.neuro.LandingPage.start(
at ej.kf.Kernel$
at java.lang.Thread.runWrapper(

Could you please help me with this issue?

Hi Shuhabazhar,

Sorry for the delay…

It seems that the issue is that you are running against the FS API.
This “FS API” module is only meant for compilation and this dependency is normally replaced at build time by the implementation provided by the VEE Port / Kernel.

Let’s understand why it is not replaced.
It seems you are running a Sandboxed Application (a “feature”).
What Kernel are you using ? For your Application to access the File System Foundation Library API, the Kernel must have it in its Runtime API.

Also, can you clarify which MICROEJ SDK version you are using ? SDK 5 (MMM / Eclipse) ? SDK 6 (Gradle) ?

Best regards,

Hi @rlouedec,
I am using ej.api:fs:2.1.1 in build.gradle file and manually added the fs-2.1.1 jar file in the following locations.

  1. …\demoapp\app\build\vee\javaLibs
  2. …\demoapp\app\build\vee\MICROJVM\javaLibs
    and I am using MICROEJ SDK 6.


Hi @shuhabazhar,

Ok, I understand now why you have the issue at runtime instead of an error at buildtime.
The javaLibs folder is for libraries implementations packaged with VEE Ports.
In your case, you added the API jar of the File System foundation library. This jar does not contain any implementation and should be used for compilation only.

Different VEE Ports may provide different implementations (versions) of the same Foundation Library API.
So applications can depend on the same API Jar, but build against different VEE Ports for different targets using different implementations/versions of the same FS API Jar.
See Libraries — MicroEJ Documentation

What you need to do in your case is to add the FS Pack to your VEE Port.
For that, you can add our FS Pack available publicly on the MicroEJ Central Repository.

In yyy-configuration/module.ivy, add:

		<!-- ... -->
		<dependency org="com.microej.pack" name="fs" rev="6.0.4"/>
		<!-- ... -->

and in yyy-configuration/yyy.platform, add:

    <group name="fs"/>

See also: File System — MicroEJ Documentation

Best regards,