To see which version of java is installed, do;
java -version
with an example of the output being;
java version "17.0.4" 2022-07-19 LTS
Java(TM) SE Runtime Environment (build 17.0.4+11-LTS-179)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode, sharing)
If we want to change the default version, first do;
/usr/libexec/java_home -V
an example of the output is;
Matching Java Virtual Machines (2):
17.0.4 (x86_64) "Oracle Corporation" - "Java SE 17.0.4" /Library/Java/JavaVirtualMachines/jdk-17.0.4.jdk/Contents/Home
11.0.15.1 (x86_64) "Oracle Corporation" - "Java SE 11.0.15.1" /Library/Java/JavaVirtualMachines/jdk-11.0.15.1.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-17.0.4.jdk/Contents/Home
then if we wanted to change it, we would do;
export JAVA_HOME='/usr/libexec/java_home -v 11.015.1'
The above is untested.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.