How to Download and Install Java JDK on Mac OS XDo you want to know how to install the Java JDK 11 (Java SE Development Kit) on your Mac? Well, you're in the. Download Java Development Kit for Mac 8.172 for Mac. Fast downloads of the latest free software!
Install the binary files provided by Oracle
- Download JDK 8 from Oracle WebSite. [jdk-8u65-macosx-x64.dmg for Mac].
- Double click on jdk-8u65-macosx-x64.dmg and follow the screen instructions.
- Once the JDK package is installed check the below output
- Verify JDK version
- Set the JAVA_HOME in your .bash_profile or .zshrc(If you are using Zshell)
- If the above path creates an issue while using maven, please replace the
JAVA_HOME
with the below path
Jdk installation
- Check if any older version exists on the machine. If exists uninstall it.
- Goto Java SE download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Run the downloaded installer (e.g., 'jdk-8u{xx}-windows-x64.exe'), which installs both the JDK and JRE.
- By default, the JDK will be installed in directory 'C:Program FilesJavajdk1.8.0_xx', where xx denotes the upgrade number; and JRE in 'C:Program FilesJavajre1.8.0_xx'.
Configure environment variables
Verify JDK installation
- Open command prompt (Start > in serach bar > type cmd.exe)
- Issue 'path' command to list the contents of the PATH environment variable. Check to make sure that your <JAVA_HOME>bin is listed in the PATH.Don't type prompt>, which denotes the command prompt!!! Key in the command (highlighted) only.
- Issue the following commands to verify that JDK/JRE are properly installed and display their version:
Write hello world program
- Create a directory to keep your works, e.g., 'd:myProject', or 'c:myProject', or any directory of your choice. Do NOT save your works in 'Desktop' or 'Documents' as they are hard to locate. The directory name shall not contain blank or special characters. Use meaningful but short name as it is easier to type.
- Launch a programming text editor (such as TextPad, or NotePad++, or Sublime Text, or Atom). Begin with a new file and enter the following source code. Save the file as 'Hello.java', under your work directory (e.g., d:myProject).
Compile and Run hello world program
To compile the source code 'Hello.java':
- Start a CMD Shell (Click the 'Start' button ⇒ 'run...' ⇒ Enter 'cmd').
- Set the Current Drive to the drive where you saved your source file 'Hello.java'. For example, suppose that your source file is saved in drive 'd', enter 'd:' as follow:
- Navigate to d:myProject folder
- Type dir
- Invoke the JDK compiler 'javac' to compile the source code 'Hello.java'.
- The output of the compilation is a Java class called 'Hello.class'. Issue a dir (List Directory) command again to check for the output.
Jdk 1.8 Download
- To run the program, invoke the Java Runtime 'java':
Download Jdk 1.8 For Mac
The following are the system requirements for installing the JDK and the JRE on macOS:
Free Download Java Development Kit
Any Intel-based computer running macOS.
Administrator privileges.
You cannot install Java for a single user. Installing the JDK and JRE on macOS is performed on a systemwide basis for all users. Administrator privileges are required to install the JDK and JRE on macOS.
When you install the JDK, it also installs the JRE. However, the system will not replace the current JRE with a lower version.
To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.
When you install the JRE, you can install only one JRE on your system at a time. The system will not install a JRE that has an earlier version than the current version.
To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.
Note:
Installing a JRE from Oracle will not update
java -version
symlinks or addjava
to your path. To do this, you must install the JDK.