Batch user has no permission to write a file


I have a Class wich writes a File to a Network share (I also tried it local it was no difference). If I start the Class in my normal Client session, it works.
But if I start it in a batch, the debugger opens and I get an Stack Trace Error.
The Infolog means I have no permisson.


This is because of missing FileIOPermission.
Processes running on Server must assert FileIOPermission while clients must not.


Statement:


fileIOPermission = new FileIOPermission(path, “w”);
fileIOPermission.assert();

Or statement


fileIOPermission = new FileIOPermission(path, “r”);
fileIOPermission.assert();

Have to be added before all access to file in runbasebatch.
Attribute “r” mean that you will read that file and “w” that you will write into that file.

Skip to main content