You need to install the development tools your personal computer, both to build the sample code, and work on your assignments (for various reasons, you cannot use lab computers for this course). This section explains what software to install.

1/ Command-Line Tools Setup

This video walks through installing Git, Gradle, and Java and building sample code from the command-line.
Getting started with Java.

You will need to install the following:
* Git Client 2.24 or later. Required to fetch code samples and submit assignments.
* OpenJDK 15.0.2. Libraries, compiler and related tools.
* Gradle 7.0. Build system that works with Java.

Make sure that the programs are in your path so that they can be executed directly.

2/ IntelliJ Setup

IntelliJ is a powerful Open Source Java IDE. It's optional for the first few assignments, but required for Android development. It supports a number of very helpful features (e.g. code completion, API documentation tooltips, debugging, profiling) and is highly recommended.

This video describes setting it up:
Getting started with IntelliJ.

3/ Sample Code

We have a public repository containing the sample code shown in lectures:

You are allowed to use these samples in your assignments. If you do so, please make a comment in the code indicating which one you used.

Fetch a local copy of the samples

Samples are maintained in a public Git repository. To get a copy, git clone the repository URL:
$ git clone cs349

You should see the following directory structure. Each of the numbered folders represents a section in the course, and contains multiple projects. All projects are built using Gradle and IntelliJ and should be runnable from within the IDE.

├── 01.Intro
├── 02.JavaFX
├── 03.Graphics
├── 04.Events
├── 05.Widgets
├── 06.Layout
├── 07.MVC
├── 08.Android
├── 09.UndoRedo
├── 10.Responsiveness

Building from the Command-Line

Gradle projects can be built and executed directly from the command-line:

  $ cd cs349

  $ cd 01.Intro/01.hello_world

  $ gradle build
  Starting a Gradle Daemon (subsequent builds will be faster)
  5 actionable tasks: 5 up-to-date

  $ gradle run
  > Task :run
  Hello world!
  3 actionable tasks: 2 executed, 1 up-to-date

Building from IntelliJ

Projects can also be built in IntelliJ:

Creating a New Project in IntelliJ

The following steps will setup a Gradle project that works from both the command-line and from within IntelliJ.

  1. In IntelliJ, File -> New Project. Select Gradle/Java as the type of project.
  2. Provide a name and location, and click OK. This will create a project.
  3. From the Project panel on the left (Cmd-1 to toggle it), you will see a list of files. Open build.gradle.
  4. Change the contents of the build.gradle file to this:
  5. Create a source file in the src/main/java folder (in this example, containing class Main).
  6. From the Gradle menu (View -> Tools -> Gradle), you should be able to "Build" and "Run" your application.
  7. Make sure that any new files that you add or create are placed in the appropriate subdirectory (src/main/java for source code, and src/main/resources for images or other assets).