304 North Cardinal St.
Dorchester Center, MA 02124
I had been experiencing issues getting java to run on a new server. While trying to check whether java was working I was repeatedly getting the following error:
java -version # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory. # Possible reasons: # The system is out of physical RAM or swap space # In 32 bit mode, the process size limit was hit
Tried increasing memory allocated to the java process, tried a lot of things mentioned by people online but nothing helped. The server had enough ram, 24GB free.
Turn’s out I had to disable MPROTECT as I was on a hardened kernel. To do this first run:
To find out where java is located run:
paxctl -c /usr/bin/java
and finally to disable MPROTECT:
paxctl -m /usr/bin/java
This now allows java to run fine, issuing the java -version command at shell no longer throws an error instead shows the version of Java installed which is what you should actually be seeing.
In case you want to turn MPROTECT back on issue the following:
paxctl -M /usr/bin/java