[JAVA-0] Prerequisites: Setting Up Your Tools

Jack Boyuan Xu
4 min readDec 30, 2019

--

Last time we talked about why we are learning Java and what makes Java stand out. I also promised we would do actual work in this article, so let’s begin!

The Basics — Java Runtime Environment and Java Development Kit

As we said last time, Java programs cannot run without the JVM. JVM is a part of a larger support package known as the Java Runtime Environment, or JRE. The Java Development Kit, or JDK, is needed to compile Java source code. Java is an evolving language, meaning there are constantly updates to the language. For now, let’s stick to version 1.8 (or 8) for consistency and also because it is the most dominant version of Java out there.

Downloading JRE and JDK from Oracle

Both JRE and JDK are available for download on Oracle’s website.

JRE: https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
JDK: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

You may be prompted to register an Oracle account before the website allows you to download JDK. It is quite annoying and if you don’t like that, there is another way (for macOS users, at least).

Linux users… If you are using Linux, then I assume you already have some mad skills and don’t need help setting things up.

Downloading JRE and JDK via Homebrew (macOS only)

Homebrew is an excellent package manager for macOS. A package manager is a piece of software that makes installing complicated libraries very easy by automating everything.

  1. Install Homebrew here: https://brew.sh
  2. Inside your Terminal, execute the following:
brew cask install adoptopenjdk/openjdk/adoptopenjdk8

3. Now you have everything ready.

Note: If step 2 doesn’t work, close and open your Terminal again.

What is OpenJDK? Since 2019, Oracle made changes to the licensing of Java 8, which is why you need to register for an account. OpenJDK is an open source distribution of JDK and for our intents and purposes, is exactly the same as Oracle’s now proprietary JDK 8.

The Knife — Integrated Development Environment (IDE)

Technically, you are now all set to start writing, compiling, and running your first Java program. Realistically though, you’d have to do that in some sort of notepad and manually call javac and java every time you want to compile and run. It isn’t the most pleasurable thing in the world and surely there is a way to make the programming experience better? Yes! Enter IDEs.

An IDE is a piece of software that provides truckloads of convenient features to make the programming experience better. Compiling and running in an IDE only take a single click and real time code inspection highlights the errors in your code as you type. From code completion to debugging, it sure is the Swiss Army knife of the programming world.

JetBrains IntelliJ

A man is only as good as his tools. — Emmert Wolf

Ever tried to cut with a dull knife? It wastes your energy and makes the entire cutting process unnecessarily frustrating. It is very important then, to pick the sharpest knife of them all.

JetBrains specializes in developing IDEs for various languages and having used 3 of their IDEs, I will tell you that their products are top-tier. But don’t take my word for it! Google’s Android Studio, the official IDE for Android development, is simply a fork of IntelliJ. IntelliJ, as you can probably tell from the name, is a Java IDE. It is precisely what we are going to use.

Fun fact: The majority of JetBrains’ IDEs are written in Java. Some new IDEs are written in Kotlin, which is a language developed by Jetbrains itself aimed to replace Java. Google is adopting Kotlin as the recommended language for Android development.

You can download IntelliJ from JetBrains’ official website. There are two editions of IntelliJ: Community and Ultimate. The former is free to everyone while the latter is only free if you are a student (with a school email).

Installation is fairly straightforward. The first time you start it up, it will ask you to complete a series of settings. Some settings are based on personal preference (light vs. dark mode), others are more technical and it’s fine to leave them as is.

Eventually you should see this screen:

Voila! We are now all set to write our first Java program!

--

--

Jack Boyuan Xu

Co-founder & Tech Lead @ EthSign. Blockchain Lecturer @ USC.