Oracle's Java version 7u25 and below have been disabled by Apple on OS X. Updating to the latest release will allow Java to be run on Mac OS X.
Download Java SE Offline Installer If you need to install java on multiple computers, or on the computers which are not connected to the Internet, offline installer is much-needed, but the java download page only provided a direct option to download the online installer (especially for Windows) which downloads the latest installation files upon installation and hence needs internet connection. The offline installers are available on the java website, but hidden behind an option which most of the users ignore and hence fail to find the offline installer. Following are the links to download offline installer of java for various systems.
Java for macOS 2017-001 installs the legacy Java 6 runtime for macOS 10.13 High Sierra, macOS 10.12 Sierra, macOS 10.11 El Capitan, macOS 10.10 Yosemite, macOS 10.9 Mavericks, macOS 10.8 Mountain Lion, and macOS 10.7 Lion. This package is exclusively intended for support of legacy software and installs the same deprecated version of Java 6 included in the 2015-001, 2014-001, and 2013-005 releases. Quit any Java applications before installing this update. See for more details about this update. See for information about the security content of this update. Keep your software up to date. If you need Java, download the latest version of Java for OS X directly from Oracle.