In my java code, I have this line `System.getProperty("java.home")`. In some environments, this returns the same value as what has been set `JAVA_HOME` as environment variable.

But in some environments, `System.getProperty("java.home")` returns completely different value from `JAVA_HOME`.

So my question is what's the difference between `java.home` and `JAVA_HOME` from java perspective? 

What i know from my research is `JAVA_HOME` is jdk installation path, `java.home` is jre installation path, but then why can't it match as jre can be part of jdk installation.