MATLAB: Do I get “Something Unexpected Occurred – java.lang.Exception: Generic Error” with an error about Java heap space while silent installing

Why do I get "Something Unexpected Occurred – java.lang.Exception: Generic Error" with an error about Java heap space while silent installing?
Java heap space
Something Unexpected Occurred: To resolve this issue, contact Customer Support.
at com.mathworks.matlab_installer.ExceptionHandlerImpl.convertException(Unknown Source)
at com.mathworks.matlab_installer.ExceptionHandlerImpl.processException(Unknown Source)
at com.mathworks.installservicehandler.context.ExceptionInterceptor.invoke(ExceptionInterceptor.java:30)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:55)
at com.mathworks.matlab_installer.services.FikInstallServices$$EnhancerByGuice$$7cc56e51.installByFik()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.installservicehandler.JsonPassThroughResponseWrapper.getData(JsonPassThroughResponseWrapper.java:24)
at com.mathworks.installservicehandler.JsonPassThroughResponseWrapper.getData(JsonPassThroughResponseWrapper.java:10)
at com.mathworks.installservicehandler.InstallServiceHandlerClient.executeService(InstallServiceHandlerClient.java:18)
at com.mathworks.matlab_installer.MatlabInstallerClient$11.executeService(Unknown Source)
at com.mathworks.installjscommon.InstallerClientUtility.executeGetNextStateInSequence(Unknown Source)
at com.mathworks.matlab_installer.MatlabInstallerClient.clientMain(Unknown Source)
Caused by: java.lang.Exception: Generic Error: Something Unexpected Occurred

Best Answer

The "Java heap space" error message indicates an issue with the amount of memory available for Java to allocate during the installation. This issue is relevant in silent installations where a large number of toolboxes are being installed.
This may be caused by the machine's memory being used up by other processes, or the computer may not have enough memory available for the installation to proceed.
You can resolve this issue by either stopping other running processes on the machine or splitting the silent installation of all of the products into two separate silent installations. A reboot may also free some of the used memory and allow the silent installation to go through.