JAVA_HOME to JDK not JRE error? Compiler is not provided on Big Sur?

First of all, find what java version is available on your machine by entering this command in your cmd. The output will contain your virtual machines, where one of them will be your path to your java version.

In my case, my version is 1.8.0, for Java SE 8.

Error 1. JAVA_HOME needs to point to a JDK not a JRE:

The solution:

Enter the .zshrc file.

Press i to insert and add your path to JAVA_HOME version.

Press control+c to exit the insert mode and type :wq to write the document and quit it. Now you have to source it.

Expected output on echo $JAVA_HOME:

Error 2. Compiler is not provided:

The solution:

Maven reads JAVA_HOME from ~/.mavenrc instead of ~/.zshrc.

Enter the .mavenrc file.

Press i to insert and add your path to JAVA_HOME version.

Press control+c to exit the insert mode and type :wq to write the document and quit it. Now you have to source it.

Expected output mvn -version:

✨ Passionate photographer and Frontend Developer @Deloitte Digital, former frontend developer @IBM and DBA @Groupe Renault