[1871] Refactor getJavaVersion

Changed the way this function operates. It now directly returns the version found in the `java -version` string instead of going to a bunch of if statements. It also makes the whole string retrieving part more compact.
This also fixes a bug in the old method, where it would match any character between the two numbers instead of a dot, as well as looking through the whole string (instead of just the simple version string).