From a terminal set the working directory to the directory containing HelloStackoverflow.java, then type the command:Īctually, a lot happened.Open a text editor, copy the code from below and save the file as HelloStackoverflow.java.
Anyway, open a new terminal and verify: echo $JAVA_HOME In ~/.zshrc, I set the variable like so: export JAVA_HOME=$(/usr/libexec/java_home) Here is a trick that allows me to keep the environment variable current, even after a Java Update was installed. OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode) OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1) After opening a terminal, the successful installation of the JDK can be confirmed like so: java -version