"java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200" after installing Java 1.8 32 bits

  32bit-64bit, java, maven, windows, x86

After installing Java 8 32 bits on my computer to perform an unrelated task, I get the above exception when running mvn install on my spark-scala project.

I am using IntelliJ and Java 8 of 64 bits for this spark-scala project and the path variables to this 64 bit Java 8 sdk are correct in IntelliJ | Project structure, and also in the POM (I have the Java 8 64-bits sdk in a user folder).

The JAVA_HOME variable is also pointing to the correct 64 bit java sdk (when I execute mvn --version I get:

Java version: 1.8.0_265, vendor: AdoptOpenJDK, runtime: C:Usersvcalabui.jdksadopt-openjdk-1.8.0_265jre

which again, is the correct 64-bit Java sdk.

However, it seems that Maven is still using the 32-bit Java somewhere since I am getting the above exception and when I uninstall the 32-bit Java from my Windows the mvn install works fine again.

Any ideas why this might be happening?

Source: Windows Questions