MATLAB: “File cannot be found” error obtained when running compiled app

appdesktopexefilefoundMATLABnotstandalone

Why do I get the following error when running the standalone app file (.EXE) generated on compiling my app in MATLAB R2019B?
Error using matlab.ui.control.internal.model.mixin.IconableComponent/set.Icon (line 54)
You have specified a file that cannot be found or is not an image.
Specify a file name that is on the MATLAB path, or use a full or relative path.
The required files and images have been compiled along with the app, and the issue is only observed on a particular system.

Best Answer

When running the standalone app, all files compiled into the application will automatically be on the MATLABPATH at runtime, and hence this error should ideally not be generated. The cause for this error to be generated on the particular system could be a cache corruption on the particular system. Deleting the following cache folder and restarting the system should fix the issue:
%TEMP%\%UserName%\mcrCache9.7