Better GetJavaPath algorithm