Install Java
This is a step-by-step guide to install Java on Mac
Install Java on Mac (manual process and using brew
) system easily and quickly
Installing Java on Mac
Installing Java on Mac. - Manual Installation
At the end of this post you would have installed Java successfully on your mac machines.
- Download latest JDK from Oracle Website.
- This will download a .dmg file to your downloads direcotry.
- Locate this
jdk-xx_osx-x64_bin.dmg
and double click on it and follow the instructions on it. Verify if Java is installed (I’m using Java 8 for purpose of this blog
Pavans-MacBook-Pro:~ pavanpkulkarni$ which java /usr/bin/java
This will install jdk in path /Library/Java/JavaVirtualMachines
Pavans-MacBook-Pro:~ pavanpkulkarni$ ls -l /Library/Java/JavaVirtualMachines total 0 drwxr-xr-x 3 root wheel 96 Dec 1 21:35 jdk1.8.0_152.jdk
Add JAVA_HOME to
~/.bash_profile
fileexport JAVA_HOME=$(/usr/libexec/java_home) export PATH=$PATH:$JAVA_HOME
Verify if the path that you just added works properly.
Pavans-MacBook-Pro:~ pavanpkulkarni$ java -version java version "1.8.0_152" Java(TM) SE Runtime Environment (build 1.8.0_152-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
Installing Java on Mac - using brew
Installing Java on Mac using brew is a simple process. You need to have brew
installed on your system as a pre-requisite. You can install brew from here
- Open terminal.
Run the following commands
Pavans-MacBook-Pro:~ pavanpkulkarni$ brew update Pavans-MacBook-Pro:~ pavanpkulkarni$ brew tap caskroom/cask Pavans-MacBook-Pro:~ pavanpkulkarni$ brew install Caskroom/cask/java
This will install the latest version of jdk in /Library/Java/JavaVirtualMachines
Verify installation by running
Pavans-MacBook-Pro:~ pavanpkulkarni$ java -version java version "1.8.0_152" Java(TM) SE Runtime Environment (build 1.8.0_152-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
Share this post
Twitter
Google+
Facebook
LinkedIn
Email