TheInfiniteKind/appbundler

/usr/libexec/java_home call wrong for new version scheme

Opened this issue · 2 comments

/usr/libexec/java_home is always called with 1.<version>+ but that is wrong.
With Java 8 and Java 11 installed.
If you call /usr/libexec/java_home -v 1.11 it tells you "Unable to find any JVMs matching version 1.11", but nevertheless returns the latest installed version 11.
If you call /usr/libexec/java_home -v 11 it properly returns the latest installed version 11.

There is no too big problem, as with 1.12+ it considers 11 newer than 1.12 and returns it, with 12+ it complains that no JVM is found and returns the latest installed version 11 which is then ruled out by the manual major version comparison. It might just be cleaner to call the tool properly.

Maybe it would make sense to add the argument -F that will not return the default JVM if the query couldn't be fulfilled.

Is it the function findJDKDylib? How about prepending 1. only when version is lower than 10?