I had installed homebrew for some tool which was working best when installed with homebrew, so I think from one of the dependencies it installed Java 20 as well so whenever I run java --version
or javac --version
it gives
openjdk 20 2023-03-21
OpenJDK Runtime Environment Homebrew (build 20)
OpenJDK 64-Bit Server VM Homebrew (build 20, mixed mode, sharing)
When running which java
gives following:
/home/linuxbrew/.linuxbrew/bin/java
But when I run sudo update-alternatives --config java
I get:
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/bin/java
Nothing to configure.
So my question is, how can I disable or remove java from homebrew so that I can use the java8 which is required for my project?