Hello World in Java (Windows)


This guide explains how to configure a Java programming environment on Windows Windows logo, create and compile a Java program in IntelliJ, and run it from the command line.

You will need a 64-bit version of Windows 10 or 11 on Intel/AMD x64 hardware. (We also have an experimental installer for Windows ARM64.)


    0.   Install the Java Programming Environment


The installer configures OpenJDK 21, IntelliJ IDEA, OSS Edition 2026.2, and the course tools and libraries.


    1.   Open a Project in IntelliJ


You will develop your Java programs in IntelliJ, which organizes programs into projects. In our context, each project corresponds to one programming assignment and contains source files, data files, and course-specific settings.


    2.   Create a Program in IntelliJ


Now you are ready to write your first Java program. IntelliJ provides syntax highlighting, bracket matching, automatic indentation and formatting, automatic imports, variable renaming, and continuous code inspection.


    3.   Compile and Execute the Program (from IntelliJ)


Before Java can execute (or run) your program, it must compile the source code.


Tip

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

Before using the LIFT menu, click inside the editor window to make it active.


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


The command line provides a simple and powerful way to control programs using command-line arguments, file redirection, and piping. IntelliJ includes an embedded terminal for convenient access.


    5.   Textbook Libraries (from the command line)


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

When you run the the program, the standard drawing window opens and animates 20 colliding disks.

To get your command prompt back, close the standard drawing window.


    Frequently Asked Questions


Expand All Collapse All


Installer FAQ
I installed IntelliJ and Java using lift-java-installer-x64.exe last semester or year. Should I run the installer again this semester?
Yes. This installer includes IntelliJ and Java 21. The old installer may have used an earlier version of IntelliJ or Java. Be sure to uninstall the old version before proceeding.
I wrecked some of my IntelliJ settings. Can I rerun the installer to restore the settings?
Yes. However, the proper way to reinstall software on Windows is to completely uninstall it and then to reinstall it. So, first, uninstall the software; then, run lift-java-installer-x64.exe.
How can I uninstall the software?
Can I run the installer using Run as administrator?
No. You must run the installer from an account in which you wish to program, and that account must have Administrator privileges. If you use Run as administrator, the installer will not know the original user’s identity (so it can’t copy files to the original user’s home directory).
The installer failed. How can I investigate why?
Check the installer logs at %TEMP%\LIFT-CS\ and %TEMP%\Setup Log YYYY-MM-DD #NNN.txt, where %TEMP% is typically C:\Users\<Username>\AppData\Local\Temp, YYYY-MM-DD is the current date, and NNN is an integer.
My machine is running Windows 8. Is that too old?
Yes. IntelliJ 2026.2 requires Windows 10 or 11.
How long will the installer take to complete installation?
After downloading, installation should take about two minutes. The progress bar will not move while it installs the IntelliJ component, so please be patient.
What does the lift-java-installer-x64.exe installer do?
In short, it installs and configures Java, IntelliJ, Git Bash, Xming, SpotBugs, PMD, Checkstyle, and our textbook libraries, along with accompanying command-line tools. Here is a more detailed list:
How is the software licensed?
All of the included software is licensed under various open-source licenses.
What’s the SHA-256 checksum of lift-java-installer-x64.exe?
2461f3ef187aa3dfd1fb5de8f000265a50fdb83de28d6e7ee41dea435495da7e
How can I run the installer from the command line?
lift-java-installer-x64.exe accepts optional command-line arguments, which can be useful to system administrators.
Java FAQ
Can I use a different Java or version?
Yes. You may use any version of Java 11 or newer from either Oracle or OpenJDK. If you do, you may need to configure the Platform SDK and Project SDK manually in IntelliJ under File → Project Structure. We recommend using long-term support (LTS) versions: Java 11, Java 17, Java 21, and Java 25.
How can I check which version of Java is installed (and where it is installed)?
Type the following commands in the terminal:
~> javac -version
javac 21.0.11
~> java -version
openjdk version "21.0.11" 2026-04-21 LTS
OpenJDK Runtime Environment Temurin-21.0.11+10-LTS (build 21.0.11+10-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.11+10-LTS (build 21.0.11+10-LTS, mixed mode, sharing)

~> which javac
c/Program Files/Eclipse Adoptium/jdk-21.0.11.10-hotspot/bin/javac

~> which java
c/Program Files/Eclipse Adoptium/jdk-21.0.11.10-hotspot/bin/java
With the default installation, javac and java should both report version 21.
IntelliJ FAQ
How does this customized version of IntelliJ different from the standard one?
IntelliJ is an industrial-strength integrated development environment (IDE), suitable for use by professional programmers. The installer configures your user preferences to make it more suitable for use by novice programmers:

The course-specific project folders provide additional customizations:

How can I manually configure the Platform SDK and Project SDK in IntelliJ?
The installer should configure the Platform SDK automatically. To configure it manually,

To manually configure the Project SDK,

Where should I store my projects?
Store projects on a local drive (not a network drive, cloud-synced folder, or SMB share). Create one course folder with a separate subfolder for each assignment.
Are ther any special characters to avoid when naming IntelliJ projects or files?
Do not end the name of a project folder (or any enclosing directory) with an exclamation mark (!); doing so confuse IntelliJ and Checkstyle.
How can I create a new project in IntelliJ?
If you want to inherit all of the properties of an existing project,

To create a new project from scratch, you can use the New Project option from the Welcome screen. But, we do not recommend this approach for novice programmers.

What are the most important IntelliJ menu options to remember?
Here are the most important ones (and their shortcuts).
Can I use a version of IntelliJ that is newer than 2026.2?
Yes, though if it is 2026.3 (or above), you will need to migrate your user preferences.
How can I restore the original IntelliJ settings (instead of the custom novice-friendly ones)?
Command-Line and Embedded Terminal FAQ
When I compile or run a program from the command line that uses one of the textbook libraries, I get an error that it cannot find the library. How can I fix this?
Make sure that you are using the appropriate wrapper script, such as javac-algs4 or java-algs4.
When I open the IntelliJ embedded terminal, IntelliJ either launches the wrong version of Bash (such as WSL Bash on MinGW Bash) or produces an error message (such as "couldn't create PTY error"). How can I fix this?
Navigate to File → Settings → Tools → Terminal → Shell path and replace bash with "C:\Program Files\Git\bin\bash.exe".
I get an error when I try to use run a wrapper script (such as javac-algs4 or java-introcs). How can I fix this?
IntelliJ is probably launching the wrong shell (such as Command Prompt, PowerShell, WSL Bash, or MinGW Bash). To reconfigure to use Git Bash, follow the instructions in the previous question.
International characters appear garbled in the terminal. What could cause this?
When you launch the terminal, you should see the message Activation code page: 65001, which configures the terminal to displays Unicode characters using UTF-8. If you don't see this message, you are probably using the wrong version of Bash (such as WSL Bash or MinGW Bash). To reconfigure to use Git Bash, follow the instructions in the previous question.
How should I configure Bash?
If you followed our instructions, our wrapper scripts (such as javac-algs4 and java-algs4) should already be available.

The installer configures Bash by copying .bashrc, .bash_profile, and .inputrc. If you accepted the default installation options, no additional configuration is required.

How do I break out of a program in an infinite loop?
Type Ctrl-C.
How do I specify EOF to signal that standard input is empty?
On macOS and Linux, press Enter, then Ctrl-D. On Windows, press Enter, Ctrl-Z, and then Enter, even in Git Bash.
How can I run SpotBugs, PMD, and Checkstyle from the command line?
The installer includes wrapper scripts to simplify this process.
Can I use the Command Prompt, PowerShell, or Windows Subsystem for Linux instead of Git Bash for Windows?
We strongly recommend Git Bash. For example, the commands javac-algs4 and checkstyle-algs4 will work only in Git Bash. If you want to use another shell, you’ll need to configure it yourself.
Which Linux-style commands are available in Git Bash for Windows?
Here are the Bash built-in commands and here are the external commands in C:\Program Files\Git\usr\bin.