Hello World in Java (Windows)


This document instructs you on how to set up a Java programming environment for your Windows Windows 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.

  • Download the Windows installer lift-java-installer.exe.

  • Double-click lift-java-installer.exe to install the software. Enter your Windows password when prompted. Use all of the default options.

    Warning

    If you have previously used IntelliJ 2023.2, run this installer only if you want a clean re-install. The installer overwrites any existing IntelliJ 2023.2 settings with our novice-friendly settings.

    The installer also performs a clean re-install of Git Bash, which will overwrite any previous user settings, including .bashrc.

  • Delete lift-java-installer.exe.


        1.   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).


        2.   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.


        3.   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.


    Tip

    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).


        4.   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.


        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.