IBM J9 spec will not allow file creation access from non bootstrapped classes

146 views Asked by At

I am using a J9 spec (wm50-arm-midp20_6.1.2.2) for a java application that runs on windows mobile and have run into a snag with needing to create files.

I get a security exception from this line in the J9 constructor for com.ibm.oti.connection.file.FileOutputStream

  if (!com.ibm.oti.vm.VM.callerIsBootstrap())
        throw new SecurityException();

Now, most of the other output stream types have a supporting connection.java class which the calls are sent through, but there is not one that supports the file stream implementations.

To work around this i am anticipating the need to write my own DLL file and call out to it from the java code, but i am wondering if anyone has had this issue and was able to work around it without having to call a native dll.

thanks in advance! JR

1

There are 1 answers

0
nemisis enforcer On BEST ANSWER

I have found my answer.

To work around this , any classes that you need to access the file system must be in the ext folder under the J9 folder.

In my case i was using microlog as my logging solution and was looking to create the files. My applications jar was not in the ext folder, so i repackaged everything so that the java classes for the appenders were in the ext folder so that they were considered to be bootstrap classes by the j9 jvm.

If anyone has any questions please ask them in the comments.

thanks to all who looked at this.