Why do I get a Java Exception when compiling with the MCR included in the package using MATLAB Compiler?

38 views (last 30 days)
I have a deployable project but when I try and compile it and select the "Runtime included in package" option, the compilation fails during the packaging phase with the following Java exception error:
 
Exception in thread "com.mathworks.toolbox.compiler.plugin.PackageCommand.embedPayload" java.lang.Exception: Update resource failed: 8
at com.mathworks.toolbox.compiler.plugin.Resource_win.updateResource(Native Method)
at com.mathworks.toolbox.compiler.plugin.Package_win.embedPayload(Package_win.java:60)
at com.mathworks.toolbox.compiler.plugin.PackageCommand$3.run(PackageCommand.java:447)
at java.lang.Thread.run(Unknown Source)
I do not get this error when I select the "Runtime downloaded from Web" option.
  The answer is also applicable if you get the PackagingLog.txt messages:
 
Failed to embed unzip in your application.
Update resource failed: 0000000037E55C30
Failed to embed installer splash screen C:\Program Files\MATLAB\R2014a\toolbox\compiler\Resources\default_splash.png.
Update resource failed: 0000000037E55CB0
Attempting to embed default installer splash screen, C:\Program Files\MATLAB\R2014a\toolbox\compiler\Resources\default_splash.png.
Failed to embed installer splash screen C:\Program Files\MATLAB\R2014a\toolbox\compiler\Resources\default_splash.png.
Update resource failed: 0000000037E55BB0
Failed to create the full installer.
No installer package created.
Or:
  ERROR: Failed to embed the install agent from C:\Users\8080\AppData\Local\Temp\8080\installAgent8.3_win64\InstallAgent.zip. Update resource failed: 000000006476EFA0 Failed to create the full installer. No installer package created.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Apr 2015
This error is usually observed when using the 32-bit version of MATLAB, when the compiler requires more virtual memory than is available. This is regardless of whether the computer running MATLAB has a 64 bit architecture.
 The compilation process is very RAM intensive, and the 32-bit MATLAB cannot utilize all physical available memory. See the following documentation for a general guide for avoiding out of memory errors:
 
>> web(fullfile(docroot, 'matlab/matlab_prog/resolving-out-of-memory-errors.html'))
 
Unfortunately because this is a physical limitation of all 32-bit systems and programs, it is not something that can be fixed. There are however a few workarounds we can recommend.
1) If you're using 32-bit Windows, all user processes are limited to 2GB of total memory by default.  This can be increased to 3GB.  To do this on Windows Vista/7/8:
  • Open a Windows command prompt with administrator privileges.
  • At the command prompt, run:  bcdedit /set IncreaseUserVa 3072
  • Restart the computer.
2) Create the PRJ file using the application/library app (DEPLOYTOOL), then compile it outside MATLAB using the script MATLABROOT\bin\deploytool.bat. 
3) Deploy the code using the MCR downloaded from web option, instead of including the MCR into the package.
4) Use 64-bit version of MATLAB and a computer with a 64-bit operating system.
 
If none of these options can be used, attached is a script that will bundle the MCR with the compiled files from the "for_redistribution_files_only" folder, or the "distrib" folder for MATLAB versions older than R2013b.
With the project name "PROJ_NAME", run the script from the same folder that the compiler was run from, e.g.:
 
>> deploytool -build PROJ_NAME.prj
(use the application/library app (DEPLOYTOOL) to package/compile the code)
>> PackageWithMCR('PROJ_NAME');
The script looks for a folder with the name "PROJ_NAME" in the current working directory, if you specified the option to compile the code into a different folder you would need to use that folder name instead.
For MATLAB R2013b and higher this will output a self extracting executable in the "for_redistribution" subfolder, for R2013a and earlier it will output it to the "distrib" subfolder. This is the same folder that the installer would normally be created in using the application/library app (DEPLOYTOOL).

More Answers (0)

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!