Unable to create and write data to a file.

I am calling a java action, after that am coming to eclipse, In ecplise In a class where we have "// BEGIN USER CODE"       and    "// END USER CODE"  inside this I am trying to create a .txt  file and want to write some data on it . I tried lot of thing but I am getting below exception.   com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.AccessControlException: access denied ("java.io.FilePermission" "D:\test123.txt" "write")     at MyFirstModule.Test12 (JavaAction : 'Test')
2 answers

Due to the security policy you can't write to the directory you are using.

Only the deployment/data/tmp directory is available for writing files.

To write to another directory turn off the emulate could security in your project settings, but be aware that this will not function in a cloud environment.


Because you are not allowed to write to any path. In this post you can find the java code to find the path where you are able to write to.




This path also works in the Mendix cloud so you do not have to change the security policy.