This chapter will walk you through downloading the necessary software for developing Java applications.
Downloading and Installing the JDK
In order to start developing programs in Java we will need to download the Java Development Kit (JDK). The JDK is a collection of software that enables you to develop Java applications on your computer. Without it, your computer would not understand what Java is or how to run Java programs. There are actually many different JDKs to choose from, developed by various companies and organisations. The one we’re going to use is called AdoptOpenJDK, although feel free to use a different one if you prefer.
To download AdoptOpenJDK:
- Go to adoptopenjdk.net
- Under Choose a Version, choose OpenJDK 11 (LTS)1.
- Under Choose a JVM, choose HotSpot.
- Click the download button. This will download the latest release of the version you selected.
- Make sure you’re downloading a suitable JDK for your operating system (OS). For instance, if your OS is Windows (64-bit) it should say “Download for Windows x64” near the top. If this is incorrect, click the “Other platforms” button and download a suitable JDK for your OS.
To install AdoptOpenJDK:
- Run the AdoptOpenJDK installer.
- Click Next.
- If you accept the terms of the License Agreement, click the checkbox. Then click Next.
- On the Custom Setup window:
- If the settings Add to PATH, Associate .jar, or Set JAVA_HOME variable have an X by them, click the X and choose “Will be installed on local hard drive”.
- Click Next.
- Click Install and wait for the installation to complete.
- Click Finish.
1LTS stands for Long Term Support. LTS versions are supported for longer and receive security updates and bug fixes but generally don’t receive feature updates. LTS versions are useful to developers who want to stick to a specific version of the JDK for a long period of time, as updating to the newest version every six months can be costly and impractical, especially for large projects.
Downloading and Installing an IDE
Now we need to download an IDE (Integrated Development Environment). An IDE is, essentially, an application for developing applications. Just like how Microsoft PowerPoint is an application for creating presentations and GIMP is an application for image-editing, an IDE is an application for writing, testing, and running programs. In fact, an IDE is what you use to create applications like PowerPoint and GIMP, which in turn are used to create their respective media.
Three popular IDEs for developing Java programs are NetBeans, IntelliJ IDEA, and Eclipse. I’ll be using IntelliJ IDEA throughout this tutorial.
To download IntelliJ IDEA:
- Go to www.jetbrains.com/idea/download
- Under the Community Edition, click Download.
To install IntelliJ IDEA:
- Once the installer has downloaded, run it.
- Click Next.
- Click Next again.
- Under Installation Options there are a few options that you can select to your liking:
- 64-bit launcher will put an icon on the desktop to open IntelliJ IDEA.
- Add “Open Folder as Project” will add an option to the context menu that pops up when you right-click a folder. This option will open the folder in IntelliJ IDEA if it contains a valid project.
- Create Associations means if you open a file with a particular extension, it will automatically open in IntelliJ IDEA.
- Update PATH variable means it will add the launcher’s directory to the PATH Environment Variable.
- If you’re not sure what to choose, personally I would check all the boxes.
- When ready, click Next.
- Click Install and wait for the installation to complete.
- Click Finish.