You can overcome this issue by adding a system variable that gives Java a specific amount of RAM. It has been specified that in almost of the cases where this error was present a significant increase in success chance, meaning that the error didn't show after the tweak was applied.
Go to Start > Run > sysdm.cpl, then Advanced > Environment variables. Add a new system variable called:
_JAVA_OPTIONS and variable value as Xmx512M. To add more RAM, change that value to 1024 and beyond.