

To me, the “correct” place to place your java install directory is: /Library/Java/JavaVirtualMachines so really, there isnt an “install” per se, but just a folder location where you place the files, to which the system is pointed.

The java executable is just put in a directory, and then the system env variable “JAVA_HOME” is pointed to it, so the system will use whatever file it is pointed at. there are many different versions of java, and many different license types, but for our purposes here that’s not something we care about, i will use oracleJava or openJava. i would love to stay more up-to-date, but i don’t think it matters for the simplistic things i usually do. Most people around me are using java 8 or 11, so i will stay with that here as well. Many of the package managers (sdkman, brew) have Java JDK and they like to copy the install files to their special custom locations, which is a bit more confusing to me, but useful for them to help you switch between multiple versions installed in parallel. There are many different ways to install java, at the end of the day they all really do the same thing, just hide it/do it for you. These are all ran (“sourced”) at slightly different times, and while all will probably work, we don’t care. Also available is zprofile, zlogin, zshenv we will just use zshrc. we will be placing all our environment variables in. Just know that java is not installed here, nor does your machine come with java built-in.Īlso, Mac recently switched from bash to zsh as the default shell. this doesnt exist anymore, but the /usr/bin/java directory does still exist so that’s kinda confusing. MacOs used to come with a pre-installed version of java, called Apple Java.

but, if you start running into trouble, it will be more difficult to troubleshoot something you don’t understand. To some, it may be easier to just download an installer, either a dmg or pkg file. this understanding will also help with troubleshooting java installs for others. there are infininte variations to this but i wanted to do a complete manual install from A-to-Z so i understand what all the installers are doing under the hood. introįirst thing is a bit of background to understand how it’s “supposed” to work. The first step is to actually get the darn thing installed, which i will try to explain and walk through below. Recently i had the situation where i needed to help a fellow tech enthusiast set up their Mac environment for java development.
