Setup

You need to install the development tools on a 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 and how to build and run the code samples.

1. Command-Line Tools Setup

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

You can also just install the tools following the instructions on this page. You will need to install the following:

  1. Git Client 2.24. You will need this to get code samples and submit assignments.
  2. OpenJDK 11.0.8. The Java SDK that we will use.
  3. Gradle 6.6. This will be used to build your projects.

I suggest installing in this order, and making sure that the programs are in your path so that they can be executed directly. You should also check and make sure that the versions are correct. For example:

$ git --version
git version 2.24.3 (Apple Git-128)

$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

$ gradle -version

------------------------------------------------------------
Gradle 6.6.1
------------------------------------------------------------

Build time:   2020-08-25 16:29:12 UTC
Revision:     f2d1fb54a951d8b11d25748e4711bec8d128d7e3

Kotlin:       1.3.72
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM:          11.0.8 (AdoptOpenJDK 11.0.8+10)
OS:           Mac OS X 10.15.6 x86_64

2. IntelliJ Setup

IntelliJ is a powerful Open Source Java IDE. It's optional for the first few assignments, but required for Android development later. 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.

IntellIJ with its default configuration should work fine. Make sure you have the following plugins installed (under File -> Preferences -> Plugins).

3. Opening Code Samples (Existing Projects)

Code samples shown during lectures, and referenced in the slides, are located in https://git.uwaterloo.ca/cs349-public/1209.git.
You are allowed to use code from these samples in your assignments.

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

  $ git clone https://git.uwaterloo.ca/cs349-public/1209.git samples

  $ cd samples

  $ cd 01.Intro/01.hello_world

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

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


Projects can also be opened in IntelliJ:

4. Creating a New Project

The public repository contains two starter projects that you can use:

Both of these can be build and executed from command-line or from within IntelliJ. You are copy and modify these for your assignments.

You can also following the instructions to create a new project.