Maven not picking JAVA_HOME correctly

It’s a bug in the Eclipse Maven support. Eclipse doesn’t support all of the global Maven properties as per the Maven specs.

According to the specs:

${java.home} specifies the path to the current JRE_HOME environment
use with relative paths to get for example

At least in Eclipse 4.3.1 that is not the case, here java.home always points to the JRE that was used to launch Eclipse, not the build JRE.

To fix the issue you need to start Eclipse using the JRE from the JDK by adding something like this to eclipse.ini (before -vmargs!):

-vm
C:/<your_path_to_jdk170>/jre/bin/server/jvm.dll

Leave a Comment