How to check the installed JDK in ubuntu or raspbian?
You can use the following command:
sudo update-alternatives –config java
To view, you can also use
sudo update-alternatives -config javac is the same.
The system will display the path of the installed JDK
There are 3 choices for the alternative java(providing /usr/bin/java).
Selection Path Priority Status
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:
If only one JDK is installed in the operating system, it will be displayed as
root@raspberrypi:/usr/lib/jvm# update-alternatives --config java
There is only one alternative in link group java(providing /usr/bin/java):/usr/lib/jvm/java-11-openjdk-armhf/bin/java
Nothing to configure.
root@raspberrypi:/usr/lib/jvm#
You can use the path /usr/lib/jvm/default-java to set your default JDK HOME path, so no matter how you adjust the default JDK, you can ensure that you can use the default JDK in the operating system.
After running the ls -alht command, we can see that the system has set default-java through ln connection.
https://www.cwiki.us/questions/57938466
Recommended Posts