Please follow this TWO PART How to install Java for your Mac.
Part 1 Download and Install Java for OS X 2015-001 (legacy version), if you've upgraded your OS recently then use Java for OS X 2017-001
This is required for MinecraftEDU.
Reference: https://support.apple.com/kb/DL1572?locale=en_US and https://support.apple.com/kb/d
Part 2 Download and install Java (JRE) (current version)
Go to https://java.com/en/download/ and downlod Java (JRE)
Install the JRE download