Any specific reason why you need to create the file outside of Mendix? You could save you a lot of time by doing everything inside of Mendix. But if you still want to do it outside of Mendix create in the Java action a Mendix filedocument and return that document to Mendix so you can pick it up in a microflow there. So you get this setup: Generate button calls microflow with Java action that returns a Mendix filedocument so you can use the download action (with delete after download option to true).
And see the community commons GetFileContentsFromResource on how to return a Mendix filedocument.
Regards,
Ronald
I create the file outside of Mendix, because inside of Mendix with a FileDocument, the result is a corrupted file.
I make another post with more information about it for getting some helps (link above)
https://forum.mendix.com/link/questions/90118
I didn't try to create FileDocument with the community commons GetFileContentsFromResource, I'll try immediatly !
Thanks for your answer