Developing Java programs requires that the Java Development Kit (JDK) be installed on your machine.
(Windows) For Windows machines, the JDK (version 8, update 181) can be obtained here, for free: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Note: If you have an older machine with a 32-bit version of Windows, the installation file you wish to use from the above site is the "Windows x86" version: jdk-8u181-windows-i586.exe, whereas if you have a more recent machine with a 64-bit version of Windows, the installation file you wish to use will be the "Windows x64" version: jdk-8u181-windows-x64.exe. To find out which version of Windows you have, go to the start menu, right-click "Computer" and then "Properties". Then look at what is listed under "System type".
To allow yourself to run java programs from the Windows command line, you will also want to update your PATH environment variable.
(OS X) As some of the previous versions of the Mac OS have done, Mac OS X ships with a Java runtime and development environments already installed. The version of Java is very similar to the version released by Sun except that it slightly lags behind the latest release for Java on other platforms, and is configured by Apple to be tightly integrated with the Mac OS X (which creates some minor differences between the two environments).
That said, if you want the latest and greatest version of Java, you can download it from the same page given above:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
The download link you seek is for "Mac OS X x64" and is named "jdk-8u181-macosx-x64.dmg". Simply save the file to your desktop or downloads folder, and then double-click it to begin the installation process.
Handy Tip: To find out where java was installed, open up the Terminal application and type
While not required to develop Java programs, an integrated development environment (IDE) makes doing so a vastly more efficient process. Eclipse is considered to be the choice du jour of IDEs by many professional programmers.
To get started with Eclipse, you should install the "Eclipse IDE for Java Developers" which can be found here: http://www.eclipse.org/downloads/ (the most recent version, as of fall 2018 is "Eclipse PHOTON")
You will discover, as you use different applications to edit your code on different machines, that tab characters in your code can often be a nuisance. To this end, it is highly recommended, once you get Eclipse installed, to do the following, which will force Eclipse to use spaces instead of tab characters when indenting: