We have a usecase wherein we want to add a pdf document as a part of our mendix application.
We want to show a help document that is in pdf format and that has to be part of mendix application.
We tried keeping the file in <projectdirectory>/resources folder and then tried to access it via GetResourcePath java action. This works fine in the local environment but when we push the changes to mendix cloud environment, then it is not able to locate that pdf file.
Please refer to another forum which suggested to put the file in the resources folder.
@Pranav indeed the file separator is different locally and in the cloud. Use FIle.separator instead of a hardcoded slash
String fileName = "nx_reporting_and_analytics.pdf"; String resourceFolderPath = Core.getConfiguration().getResourcesPath().toString(); String filePath = resourceFolderPath +File.separator+fileName;
Maybe a silly question, but what kind of slashes do you use in the file path? Do you account for linux vs windows differences?
Can you show the entire code where you read the file?
An alternate approach which I would suggest is as below
Hope this helps