Hello World in Java (Linux)

This document instructs you on how to set up a Java programming environment for your Linux Linux logo computer. It also provides a step-by-step guide for creating and compiling a Java program in IntelliJ and executing it from the command line.

You will need a 64-bit version of Linux (such as Ubuntu, Fedora, or Debian) with root privileges.

    1.   Install Java

You will use Java SE Development Kit 11 (JDK 11).


Skip this step if you already have JDK 11 installed.

    2.   Install Command-Line Tools

Next, you will install our textbook libraries, SpotBugs, PMD, and Checkstyle to /usr/local/lift and associated wrapper scripts to /usr/local/bin.

You should not need to update any shell configuration files (such as .bashrc) or set any environment variables (such as JAVA_HOME or CLASSPATH). For reference, here are our recommended shell configuration files for Bash:
    3.   Install IntelliJ

Now, you will install IntelliJ.

    4.   Open a Project in IntelliJ

You will develop your Java programs in an application called IntelliJ IDEA, Community Edition.

IntelliJ organizes Java programs into projects. In our context, each project corresponds to one programming assignment. A typical project contains Java programs, associated data files, and course-specific settings (such as compiler options, style rules, and textbook libraries).

    5.   Create a Program in IntelliJ

Now you are ready to write your first Java program. IntelliJ features many specialized programming tools including line numbering, syntax highlighting, bracket matching, auto indenting, auto formatting, auto importing, variable renaming, and continuous code inspection.

    6.   Compile and Execute the Program (from IntelliJ)

Now, it is time to execute (or run) your program. This is the exciting part, where your computer follows the instructions specified by your program. Before doing so, you must compile your program into a form more amenable for execution on a computer.


Use the LIFT menu to compile and execute your program from IntelliJ. The Build and Run menus support additional options for advanced programmers.

Also be sure that the main editor window is active before using the LIFT menu (e.g., by clicking the code you want to compile or execute).

    7.   Compile and Execute the Program (from the command line)

The command line is a simple and powerful mechanism for controlling your programs (e.g., command-line arguments, file redirection, and piping). IntelliJ supplies an embedded terminal for easy access to the command line.

    8.   Textbook Libraries (from the command line)

To make our textbook libraries accessible to Java from the command line, you will use our wrapper scripts.