Increasing the Java heap space allows J/Link to use more memory. This helps J/Link when it requires more memory than it can normally access. To increase the Java heap space in Mathematica, restart the Java Virtual Machine with a special argument.
Open Mathematica and run:
Whenever you restart Mathematica or start a new kernel, this code needs to be evaluated for J/Link to have access to the additional heap space.
To have the code automatically evaluate when you start Mathematica, place the code in Mathematica’s init.m file.