- Java For Mac
- Install Jdk Mac Brew
- Mac Install Java
- Install A Jdk For Mac Download
- How To Install A Jdk For Mac
- Install A Jdk For Mac Mojave
Download and install the Azul Zulu for Azure - Enterprise Edition JDK builds for Mac. These steps download a ZIP file to your Mac. There is also a DMG version available. Download the 64-bit Azul Zulu JDK 8 as a ZIP file: zulu-8-azure-jdk8.44.0.11-8.0.242-macosxx64.zip; Or check for a later Zulu 8. Double-click on the downloaded file and follow the installation prompts; On the second installation screen next to the phrase installed to: write down the location where the JDK will be installed. (e.g., C:Program FilesJavejdk1.8.066). On the Mac, there was a bug with the latest version of the JDK that interacted with IntelliJ Idea.
During one of AWS Lambda exploration projects, I need to use Amazon’s swagger-import-tool for uploading swagger documents to AWS. The problem is that this tool has a dependency on Java 8, however, my installed JDK is 7, and I have to keep it for all existing Java projects. It seems that I need to have something like NVM (Node Version Manager) … this time for JDKs.
After some Google searches, a promising solution is to use jEnv – a command line tool to set JAVA_HOME on the fly.
Homebrew Cask
Java For Mac
Important Oracle JDK License Update The Oracle JDK License has changed for releases starting April 16, 2019. The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost - but other uses authorized under prior Oracle JDK licenses may. JDK Installation Instructions. When you install the Java Development Kit (JDK), the associated Java Runtime Environment (JRE) is installed at the same time. The JavaFX SDK and Runtime are also installed and integrated into the standard JDK directory structure. Depending on your processor, the downloaded file has one of the following names. After installing Java for macOS 2012-006, can I continue to use Apple's Java 6 alongside the macOS JDK for Java 13? If you want to continue to develop with Java 6 using command-line, then you can modify the startup script for your favorite command environment.
On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8.
Install Homebrew Cask first if you haven’t:
If your brew or cask is outdated, update and upgrade:
Install Java 7 and 8
People on the Stackoverflow cautioned not to install 8 until 7 is installed. So we are going to install JDK 7 first.
Unlike other version managers such as NVM, jEnv itself doesn’t install JDKs. You have to do it yourself. Luckily, Homebrew Cask made this task really easy. But before doing that, let’s check if we already have JDK 7 installed by Homebrew Cask:
If Java 7 is installed, you should see something like this:
Otherwise, install Java 7:
If you run into permission issue, add sudo
at the beginning of the above command.
As of today, Java 8 is the latest stable. Run the following command to install Java 8:
These two JDKs will be installed at the following directories. Your JDKs’ minor and patch versions might be different.
Enter jEnv
Now it is time to install jEnv:
Add the following lines to ~/.bash_profile. This will initialize jEnv.
Install Jdk Mac Brew
jEnv doesn’t install JDKs, so we have to tell jEnv where to look for them. Type these commands to register JDKs in jEnv (replace the minor and patch versions with yours):
After that, run this command to list all registered JDKs:
The output will be something like this:
The version with an asterisk is the active version.
In my case, I need to keep JDK 7 as my default version, so I set the global version to 1.7:
And in my project, I set the local JDK version to 1.8:
Mac Install Java
The above command will create a .java-version
file at project root. Its content is the version I just picked for this project:
References
Install A Jdk For Mac Download
To learn more about jEnv, here I list some references:
How To Install A Jdk For Mac
- jEnv official site
- The Stackoverflow thread
- Andrew John’s blog post