Setting up Java for development

To run, build and create Java apps you need to have Java installed on your machine and this page provides a step by step guide to get Java setup on your machine.

If there is anything missing or not clear in this guide, please leave a comment below.

What are we going to install?

Java Development Kit or JDK is responsbile for compiling Java application into runnable code. It also provides a series of basic libraries that we can use in Java development.

Installing on Mac

  1. First you will need to download the Mac OSX version of JDK from here: https://www.oracle.com/java/technologies/javase-jdk15-downloads.html
  2. Open the .dmg and wait for it to mount a disk which contains the JDK installer
  3. Open the mounted disk and run the installer and follow the instructions through it to install JDK
  4. Once the installation has completed open up a terminal window (Found in /applications/utilities folder) and enter java -version. You should see output similar to this to indicate Java is installed and ready to go:

Note: The version number should be 15.0.2 or higher

JDK installed on Mac

Finally, enter javac -version. You should see output similar to this to indicate Java is installed and ready to go:

JRE installed on Mac

You can find more details on the install process here: https://docs.oracle.com/en/java/javase/11/install/overview-jdk-installation.html

Installing on Windows

  1. First you will need to download the Windows version of JDK from here: https://www.oracle.com/java/technologies/javase-jdk15-downloads.html
  2. Once the .exe has been downloaded, run it and follow the instructions
  3. Once the installtion has completed. Update the PATH so that it contains the path to the ‘bin’ folder of the installed copy of JDK (For example adding C:\Program Files\Java\jdk11.0.5\bin). You can find more details on where and how to update your path to point to the bin folder here https://www.java.com/en/download/help/path.xml and here https://www.computerhope.com/issues/ch000549.htm
  4. Once the installation has been completed open a command line window (Search for cmd in the Start section) and enter java -version. You should see output similar to this to indicate Java is installed and ready to go:

Note: The version number should be 15.0.2 or higher

JRE installed on Windows

Finally, enter javac -version. You should see output similar to this to indicate Java is installed and ready to go:

JDK installed on Windows

Frequently asked questions

I am receiving issues around installing the JDK

If you are attempting to install this on a work computer, it may be that you don’t have the correct permissions to install the JDK. Have a conversation with your IT department to see if they can install the JDK for you, or give you the correct permissions to give you the freedom to install. Failing that, for our workshops, consider using a personal machine where you are likely to have the correct permissions.

If the issue isn’t around permission sets, Google the error you are getting and see if sites such as Stack Overflow offer solutions.

When I run java -version / javac -version it tells me it’s not recognised

If you have installed the JDK but are receiving errors in your terminal or command about java or javac not being available it is likely that the environmental variable for your system named PATH is missing details of where your copy of the JDK are installed.

Oracle offer a useful guide on how to update your PATH to add the JDK folders to your PATH that you can find here: https://www.java.com/en/download/help/path.xml

Comments