Selecting Java versions by setting JAVA_HOME $ JAVA_8=$(alternatives -display java | grep 'family java-1.8.0-openjdk' | cut -d' ' -f1)Ī similar approach can be followed for javac. Similarly, switching to JDK 8 via alternatives by non-interactive means: $ JAVA_11=$(alternatives -display java | grep 'family java-11-openjdk' | cut -d' ' -f1) Here is an approach to switch to JDK 11, via alternatives, using non-interactive means, which comes in handy if you need to script it: There are 2 programs which provide 'javac'. There is no need to switch anything else as every other JDK binary will switch either with the java or the javac binary: We do the same for javac since java and javac are independently managed. This will switch the system java binary to JDK 11. There are 2 programs which provide 'java'. Next, we are going to switch to JDK 11, using the alternatives -config command: We see that java and javac are managed by alternatives. First, lets see which binaries are managed by alternatives: JDK 8 has been given a higher priority on RHEL-8 than JDK 11. The alternatives system uses priorities in order to determine which JDK should be available via /usr/bin/java. This means a system administrator can switch the system java (or javac) to be something other than the default, JDK 8. Java and javac binaries on RHEL 8 are managed by the alternatives system. Selecting Java versions with alternatives
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |