Path () { // first, try the special environment variable String candidatesPath = mySystemInfo.getEnvironmentVariable("SDKMAN_CANDIDATES_DIR"); if (candidatesPath != null) { Path candidatesDir = mySystemInfo.getPath(candidatesPath); if (Files.isDirectory(candidatesDir)) { return candidatesDir; } } // then, try to use its 'primary' variable String primaryPath = mySystemInfo.getEnvironmentVariable("SDKMAN_DIR"); if (primaryPath != null) { Path candidatesDir = mySystemInfo.getPath(primaryPath, "candidates"); if (Files.isDirectory(candidatesDir)) { return candidatesDir; } } // finally, try the usual location in UNIX if (!(this instanceof JavaHomeFinderWindows)) { Path candidates = getPathInUserHome(".sdkman/candidates"); if (candidates != null && Files.isDirectory(candidates)) { return candidates; } } // no chances return null; }