A0: Getting Started
You will stage your development environment to build a simple Java 11 application, and then push it to your Git repo. This will give you a working project that you can use as the basis for later assignments.
This assignment requires you to:
- Install and configure the required development tools.
- Download, compile and run the starter application.
- Use `git' to add, commit and push the files from A0 to your Git repo.
Detailed StepsThe following section describes each of these steps in detail. Please pay close attention to version numbers when installing software.
1. Install and Configure your Development Environment
This assignment can be completed either in an MC computer lab, or on your personal machine (Windows, Mac and Linux are all supported). We highly recommend working on your personal machine if possible, but if you decide to work in the lab exclusively, you can skip this step.
If you are working on your own machine, you will need to install the following:
- Git 2.24 or later. The main Git website has downloads, reference material etc.
- Java SE Development Kit 11 (JDK). You should install the OpenJDK 11. Do NOT install the JDK from the Oracle site.
- IntelliJ 2019.3 or later. You can install the Open Source IntelliJ Community edition or the Ultimate version if you have a Student License. You can use this IDE for both Java and Android projects.
2. Clone your Git repositories
In Git, you work with local copies of files from remote repositories. There are two repositories that we will use in this course:
- A public repository that contains lecture slides and sample source code. If you haven't already done so, clone the public repo to get the sample code and starting project on your machine. This command would clone the public repo into a directory named `public':
git clone https://git.uwaterloo.ca/cs349-public/1205.git public
- A private repository that only you can access that you will use to submit your assigments. If you haven't already done so, create a working copy of your personal repo by 'cloning' the remote repository. This command would clone the public repo into a directory named `assignments'. Replace `username` with your Quest login name, e.g. jdoe.git:
git clone https://firstname.lastname@example.org/cs349-spring2020/username.git assignments
3. Add project code and check that it builds & runs
- Copy the starting code from the public repo (`public/starter') into your working directory (`assignments') to produce a directory structure that looks something like this:
a0/ ├── out │ └── src ├── readme.md ├── src │ └── Main.java │ └── SystemInfo.java └── starter.iml
- Launch IntelliJ, and File-Open the 'a0' directory. This will open the project in the IDE.
- In order to make the project works, you should :
- set the Java SDK and its version
- mark the
srcfolder as a source folder
- set the
outfolder as the output folder
- add a configuration to run the Main class (Tip: right-click on Main.java then click on "Run as Main")
- If you get any warnings in the IDE (e.g. SDK not found), follow the instructions provided to fix them.
- 'Build-Build Project', and check the output to make sure it compiles. 'Run-Run' to test it. You should see something similar to the following output as your program executes the Java code (it may vary slightly based on your platform and Java version).
java.vendor: AdoptOpenJDK java.version: 11.0.5 os.arch: x86_64 os.name: Mac OS X os.version: 10.15.1
More detailed instructions on how to setup your environment are on this pageYour final and ready-to-submit project should look like this :
a0/ ├── .idea ├── out │ └── src ├── readme.md ├── src │ └── Main.java │ └── SystemInfo.java └── starter.imlThe
.ideafolder holds intelliJ settings of the project such as the SDK, and folder's types and is needed. It is generated by IntelliJ when the project is opened.
4. Commit and push the project to a remote Git repositoryYou can do this in IntelliJ directly (from VCS menu) or by using Git on the command line.
- Add all of these files to the `staging area'. This is how you tell git which changes you want to save (
git add *on the command line).
- Commit your staged changes (
git commit -m "Added a0").
- Push these changes to the Git server (
- Check the Git history to confirm that your change was committed and pushed (
git log). You can also go to http://git.uwaterloo.ca and check that your project has been uploaded to your repository.
A0 is not graded, but must be submitted before other assignments will be marked.