Some applications need to discover Java installations.
NixOS already populates
JAVA_HOME and adds
javac to the
PATH, which is a great start.
However, some applications want to discover not just the ‘current’ Java, but all installed/available JRE/JDK’s. Unfortunately, there’s no nice convention on how to make their
JAVA_HOME's discoverable. The result of this is that applications are resorting to terrible hacks
In the long run, I would like those terrible hacks to also discover JDK’s installed on NixOS.
Perhaps we should think about providing a not-too-terrible way to discover JRE/JDK’s in NixOS, and then add support for that approach to those tools?
One way I could imagine would be to introduce a
JAVA_HOMES environment variable to hold a colon-separated list, and have each JDK package contribute its
JAVA_HOME to that list (just like it contributes its bin directory to the
PATH). Would that make sense?