I'm on FreeBSD 13.1, and I'm trying to set the default Java version when I run /usr/local/bin/java to be 17, however I also need JDK 8 to be installed for one application that I configured manually (and so was much easier to update the init script for just that one to specify JDK 8 than it would be to do so repeatedly for package-based apps which don't work with JDK 8 and require something newer).
My understanding is that the executable symlinked there is just a wrapper which is supposed to just use whichever runtime is listed first in /usr/local/etc/javavms, but that doesn't seem to be what's happening for me:
I have /usr/local/openjdk17/bin/java listed first, which I thought would mean that JDK 17 would be selected if I don't specify one, but it seems it's still pulling JDK 8. Am I doing something wrong here?
My understanding is that the executable symlinked there is just a wrapper which is supposed to just use whichever runtime is listed first in /usr/local/etc/javavms, but that doesn't seem to be what's happening for me:
Code:
kreeblah@bigwhoop:~ $ which java
/usr/local/bin/java
kreeblah@bigwhoop:~ $ java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode
kreeblah@bigwhoop:~ $ env JAVA_VERSION=17 java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment (build 17.0.5+8-1)
OpenJDK 64-Bit Server VM (build 17.0.5+8-1, mixed mode, sharing)
kreeblah@bigwhoop:~ $ env JAVA_VERSION=8 java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
kreeblah@bigwhoop:~ $ cat /usr/local/etc/javavms
/usr/local/openjdk17/bin/java
/usr/local/openjdk8/bin/java
I have /usr/local/openjdk17/bin/java listed first, which I thought would mean that JDK 17 would be selected if I don't specify one, but it seems it's still pulling JDK 8. Am I doing something wrong here?