There are a wide variety of possible JDKs (OpenJDK, Oracle, OSX, etc.) as well as standard paths for the JDK. This includes code to look in standard paths for various platforms and enumerate the installed JDKs (e.g. 6, 7, 8, 9). That is then used for `JAVA[6-9]_HOME` env vars and the path for `jarsigner` and `keytool`.