OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode) Update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual java -version Press to keep the current choice, or type selection number: 2 Press to keep the current choice, or type selection number:Īfter typing selection number 2, update-alternatives will modify the symbolic link to update the default java to use JDK 8. * 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto modeġ /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual modeĢ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode There are 2 choices for the alternative java (providing /usr/bin/java). ![]() To set java to use JDK 8 as the default, you can use an interactive command update-alternatives -config java. ![]() usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java usr/lib/jvm/java-11-openjdk-amd64/bin/java To list all alternatives of java, use update-alternatives -list java. You can see java is pointing to actual program at /usr/lib/jvm/java-11-openjdk-amd64/bin/java, which belongs to JDK 11. Javac auto /usr/lib/jvm/java-11-openjdk-amd64/bin/javac Java auto /usr/lib/jvm/java-11-openjdk-amd64/bin/java To list all entries of alternatives in the system, use update-alternatives -get-selections. Each entry here is a shortcut points to the actual program, which may have more than one option (i.e. Ubuntu keeps track of the default programs by maintaining a list of symbolic links, under /etc/alternatives directory. After installed JDK 8 with apt-get install openjdk-8-jdk, JDK 11 is still the default one. ![]() Now you would like to work on a project that only supports JDK 8. OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing) OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1) With Debian and Ubuntu's update-alternatives utility, it is easy to choose the default one to use.įor example, let's assume you have JDK 11 installed in the machine, and by default java points to JDK 11: java -version It is common to have multiple versions of the same software installed on a single ubuntu machine.
0 Comments
Leave a Reply. |