Some times if you are a new macOS user or even pro, it takes some time to find out which Java version I’m running with? What if you want to use Java 1.7 with Eclipse IDE?
While running Eclipse with new Macbook, you may see an error about installing Java SE 6. Follow steps mentioned in that tutorial to fix it. But after finish installation, you may need to switch between JRE’s like 1.6, 1.7 or 8 (latest Java). Well if you have any of below questions then you are at correct location.
- Where is Java installed on my Mac OS X system?
- How can I setup latest JDK 1.7.X to default workspace in Eclipse in Mac?
- JRE 7 Installation for Mac OS X
- Important Java Directories on Mac OS X
- Where is Java 7 Installed on Mac OS X?
- How to switch JDK version on Mac OS X
- Mac OS X Platform Install FAQ
There are two ways you could install Java on macOS:
Option-1) Command line:
Downloading Java JDK on Linux via wget is shown oracle.com license page
instead.
Download JDK 12.0
macOS:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12+33/312335d836a34c7c8bba9d963e26dc23/jdk-12_osx-x64_bin.tar.gz
Linux:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12+33/312335d836a34c7c8bba9d963e26dc23/jdk-12_linux-x64_bin.rpm
Windows:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12+33/312335d836a34c7c8bba9d963e26dc23/jdk-12_windows-x64_bin.exe
Download JDK 11.0.2
macOS:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/11.0.2+9/f51449fcd52f4d52b93a989c5c56ed3c/jdk-11.0.2_osx-x64_bin.tar.gz
Linux:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/11.0.2+9/f51449fcd52f4d52b93a989c5c56ed3c/jdk-11.0.2_linux-x64_bin.rpm
Windows:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/11.0.2+9/f51449fcd52f4d52b93a989c5c56ed3c/jdk-11.0.2_windows-x64_bin.exe
Download JDK 8.0.201
macOS:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-macosx-x64.dmg
Linux:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm
Windows:
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-windows-x64.exe
Option-2) UI based:
Mac OS X information for installing and using Java:
1. Download latest JDK from Oracle (This is 64-bit only).
2. Double click to install it.
3. This installs JDK into Location
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
How can I setup latest JDK 1.8.0_45
to default workspace in Eclipse in Mac?
Step-1
Open Eclipse IDE.
Step-2
Open Preference -> Java -> Installed JREs -> Add.
Step-3
Select Standard VM -> Directory -> JRE Home (provide /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
)
Step-4
Click Finish.
Step-5
Validate your steps by typing “java -version
” in terminal window.
Step-6
And you are all set.
Also, there is a command java -verbose
. It returns complete path at the end of command.