I\'m not quite sure how I got into this mess, but for some reason I\'m not able to change the current version of Java using alternatives. I can run alternatives --config java a
Updated with more explanations
Check which java
executable is really running, e.g.
$ type java
If this shows something other than /usr/bin/java
, then you've likely got a specific JRE/JDK hardcoded in your path. This is fine, but you won't be able to use change Java versions using RH alternatives for any account that hardcodes a specific JRE/JDK in its PATH
in this way. However, other packages/accounts (e.g. system processes) that don't hardcode a specific JDK version into its path will use the alternatives
-specified JRE.
Check your JAVA_HOME
environment variable, e.g.
$ echo $JAVA_HOME
If this is set, this will sometimes point the java executable at a different JRE/JDK, regardless of where the java
executable itself lives. Again, its not unusual to set this, but you won't be able to use change Java versions using RH alternatives for any account that hardcodes a different JAVA_HOME.
All that said, for development in my account, I normally set a specific JDK in my path and set JAVA_HOME to point to a specific JDK, rather than rely on the system settings. RH alternatives is fine to control what Java version other packages use, but for my own development, I like to explicitly target the Java I want to use.