improve detection JRE/JDK home detection using which

This is a  fix for #1