Question: I am trying to set my machines javac version to 11 from 18.0.2 and I'm doing the following steps

1. open ~/.zshenv
2. export JAVA\_HOME=$(/usr/libexec/java\_home -v11)
3. source ~/.zshenv

When I check the version, I still get it as 18.0.2. Not sure what I am doing wrong here.
Could someone please help me with this? Been stuck on this forever.

Answer: 
What works like a charme for me is using jenv: <https://www.jenv.be/>

With jenv you can also switch between different Java versions.

Before using jenv, I relied on the Maven toolchains plugin: <https://maven.apache.org/plugins/maven-toolchains-plugin/>

Thus, I actually never really worried about `JAVA_HOME` on MacOS. Maybe one of these options also is an alternative for you.
```
export JAVA_HOME=`/usr/libexec/java_home -v 11` 

```