New comment by classabbyamp on void-packages repository https://github.com/void-linux/void-packages/pull/47416#issuecomment-1829943383 Comment: basically what needs to happen is: - if only 1 JRE is installed, it should be `java` and the same for the other JRE programs - if only 1 JDK is installed, same thing for the JDK tools - if multiple JREs or JDKs are installed, then the `java` and JDK tools must be the same version. but because each version is split in 2 packages, it's hard to do. I think it may be possible to do this with a script (multicall, so it can act as any of the tools) that gets installed in /usr/bin. Perhaps the alternative group could manage a symlink like `/usr/lib/jvm/openjdk-jre -> /usr/lib/jvm/openjdk##` and `/usr/lib/jvm/openjdk-jdk -> /usr/lib/jvm/openjdk##`, and the script wrapper ensures they're the same version. ```sh #!/bin/sh prog="$(basename "$0")" if [ -e "/usr/lib/jvm/openjdk-jdk" ]; then if [ "$(realpath /usr/lib/jvm/openjdk-jdk)" != "$(realpath /usr/lib/jvm/openjdk-jre)" ]; then echo "WARNING! JDK/JRE mismatch! use xbps-alternatives to choose one" fi exec "/usr/lib/jvm/openjdk-jdk/bin/$prog" "$@" fi exec "/usr/lib/jvm/openjdk-jre/bin/$prog" "$@" ``` (just spitballing here)