---
title: "Jam 00 - Exercise 3 - Project Structure Setup"
tags:
- 4 🥳 done
- jam00
- setup
- project
- structure
---
<!-- markdownlint-disable line-length single-h1 no-inline-html -->
<!-- markdownlint-configure-file { "ul-indent": { "indent": 4 }, "link-fragments": {"ignore_case": true} } -->
# Exercise 3 - Project Structure Setup
{%hackmd dJZ5TulxSDKme-3fSY4Lbw %}
## Overview - Exercise 3
Professional software development requires consistent organization and structure. In this exercise, you'll create a standardized project structure that follows industry best practices and prepares you for using professional build tools like Gradle.
In Java, code is organized into **packages** - a way to group related code files together and prevent naming conflicts. Each jam will have its own package (for example, `jam00` for this first jam) to keep the code organized and separated. We will use **Gradle** to manage building your software as we progress through the course, and Gradle expects this specific directory structure.
:::info
🔑 **Why Project Structure Matters**
- Follows industry standard practices
- Required by build tools like Gradle
- Makes collaboration easier
- Keeps code organized as projects grow
- Separates different types of files (source, tests, resources)
- Uses Java packages to organize related code
:::
## Project Structure Overview
Your work will be organized following this structure:
```text
csci205_jams/ # Main project directory & repository name
├── src/ # All source code
│ ├── main/ # Main program files
│ │ ├── java/ # Java source code
│ │ │ └── jam00/ # Package for this jam
│ │ └── resources/ # Program resources
│ └── test/ # Test-related files
│ ├── java/ # Test source code
│ └── resources/ # Test resources
```
:::warning
🚨 **Project Structure Requirements**
These organization requirements are strictly enforced - NO EXCEPTIONS! While you'll only receive warnings for the first couple of jams, after that you will lose points for not following these guidelines. Key requirements:
- All files must be in the correct directory structure
- All Java code must be in the correct package
- Your code must work correctly when submitted (we'll learn about compiling Java code in the next jam)
- All previous jams must continue to work correctly - if an earlier jam stops working, it will affect all future submissions
Take time now to understand these requirements thoroughly!
:::
## Required Steps - Project Structure Setup
**⚠️ WARNING:** If you skipped the Shell prompt tutorial in Exercise 1, YOU WILL BE LOST with this next section! We will not give you every command! You need to figure it out.
1. **Open your terminal**
**WINDOWS USERS** – Remember to always use **Git Bash**. Never use Windows command interpreter or PowerShell! These apps will get you in trouble every time. USE Git Bash!!!
- You should see a shell prompt (we'll use `$` in our examples for simplicity)
```bash
$
```
Though, it is quite likely your actual prompt is more complex.
:::info
🔧 **Command Line Prompts**
Throughout this course, you'll see commands preceded by a $ symbol, like this:
<!-- markdownlint-disable MD014 -->
```bash
$ git status
```
<!-- markdownlint-enable MD014 -->
The `$` represents your command prompt - it's not part of the command itself. When entering commands:
- Do NOT type the `$`
- Only type what comes after it (e.g., git status)
Different systems may show different prompts (like `%`, `>`, or `~$`). Regardless of what your prompt looks like, only enter the actual command that follows it.
:::
2. **Choose Your Project Location**
- Decide where you are going to keep your coursework
- Many students keep their coursework in their `~/Documents` directory, or better yet, `~/Documents/Coursework`
- Remember: `~` is an alias for your home directory! Never forget this!
- Others like to use their Desktop folder (which I never suggested anyone do!)
- For example, I could use `~/Documents/Coursework/CSCI205/` to store all work for CSCI 205 - Decide where you are going to keep your work for CSCI 205, and make your coursework folder
- Use `cd` to change to your chosen directory
```bash
$ cd ~/Documents/Coursework/CSCI205
# Replace ~/Documents/Coursework/CSCI205 with your chosen folder
```
3. **Create Your Project Root**
All jams for the course will belong to a single Java "project". Projects are stored in a single directory, with multiple subdirectories to manage different parts of your code.
We will call our project directory for the jams `csci205_jams`. So, let's create your project directory and then change your current working directory to it:
<!-- markdownlint-disable MD014 -->
```bash
$ mkdir csci205_jams
$ cd csci205_jams
```
<!-- markdownlint-enable MD014 -->
Use the `pwd` command at the prompt to show your current working directory. It should show the _complete_ path from the root directory of your file system to `csci205_jams`.
```bash
$ pwd
/home/username/Documents/Coursework/CSCI205/csci205_jams
```
4. **Create the Source Structure**
This directory structure is **required** by Gradle - it is not flexible or optional. Any other structure **will not work**. (Don't worry about what Gradle is yet - we'll learn about it later. For now, just focus on creating the exact directory structure shown below.)
Let's create the directories for your main source code:
<!-- markdownlint-disable MD014 -->
```bash
$ mkdir src
$ mkdir src/main
$ mkdir src/main/java
```
<!-- markdownlint-enable MD014 -->
5. **Create the Test Structure**
Professional software development requires testing your code. _We'll learn more about unit testing later_, but for now, we need to create the directories where our test code will live:
<!-- markdownlint-disable MD014 -->
```bash
$ mkdir src/test
$ mkdir src/test/java
```
<!-- markdownlint-enable MD014 -->
6. **Create the Resources Directory**
Large software projects have _resources_ – additional supporting files that are required to run your program, but may not be source code. Pictures, images, audio files, XML files, etc. are all examples of typical resource files that may be included in a project. They go in their own folder:
<!-- markdownlint-disable MD014 -->
```bash
$ mkdir src/main/resources
$ mkdir src/test/resources
```
<!-- markdownlint-enable MD014 -->
7. **Create Your First Package**
- Create the directory for this jam's code
- In Java, packages help organize related code
- Each jam will have its own package to keep code separate
<!-- markdownlint-disable MD014 -->
```bash
$ mkdir src/main/java/jam00
```
<!-- markdownlint-enable MD014 -->
8. **Verify Your Structure**
- Check that all directories were created correctly
- Your output should match the example below
<!-- markdownlint-disable MD014 -->
```bash
$ find .
```
<!-- markdownlint-enable MD014 -->
The period at a shell prompt is a shell alias for your current working directory. So, we're asking to list the directory structure from the current working directory, which should be `csci205_jams`.
You should see the following output (order might be different, but the directories should be present):
```text
.
./src
./src/main
./src/main/java
./src/main/java/jam00
./src/main/resources
./src/test
./src/test/java
./src/test/resources
```
## Required Steps - Create Your First File and explore IntelliJ
Excellent! So far so good. Now, we are going to edit a file called `answers.txt` in your jam00 folder. Let's open this file in **IntelliJ**
1. **Open your project in IntelliJ**
- Open IntelliJ and select "Open" to open your project directory
- Navigate to and select your `csci205_jams` directory
- If you are prompted to trust the authors of the files, select the checkbox and **Yes**.
2. **Expand the folders to reveal your newly created jam00 folder**

3. **Right click on jam00, and using the popup window, Select New>File to create a new file. Name the file `answers.txt`**

You should notice a new tab appear in VS Code ready for you to edit your file.
4. **Enter your _own_ identifying information at the top**
- You should minimally include something like the following (replacing the header with your own information.). For example:
```text
Name: Studious Maximus
Class: CSCI 205
Lecture Section: 01 - 2 pm
Lab Section: 60 - 10 am
Jam: Jam00
```
5. **About Saving Files in IntelliJ**
IntelliJ automatically saves your files as you type - there's no need to manually save! This feature, called autosave:
- Saves your work continuously
- Prevents lost changes
- Eliminates the need for Ctrl+S/Cmd+S
- Works for all file types
:::info
🔧 **Note**: While IntelliJ autosaves your files, you'll still need to commit your changes to Git (which we'll learn about later).
:::
6. **Open a Terminal in IntelliJ**
IntelliJ supports running new shell prompts right within it. Select **View ⇒ Tool Windows ⇒ Terminal**. You should notice a new terminal window appear at the bottom of IntelliJ.
There is also a terminal icon in the bottom left of the IntelliJ window or you can determine the keyboard shortcut for opening the terminal for your operating system.
7. **Check Your Location**
At the shell prompt, use the `pwd` command to print the entire path of your current directory. Assuming you have not changed directories, the path you see is the path of your project folder.
You will now see occasional questions for you to answer. Place your answers in `answers.txt`:
>[!Important] Question 1.1
> Change your current directory to your home directory by typing `cd`, then hit ENTER. Then use the `pwd` command to show the full path to your _home_ directory. What is it?
Write your answer in `answers.txt`. Be sure to note each answer to your question with the question number. For example, it might be `/Users/abc123`. So, I would enter:
```text
1.1 - /Users/abc123
```
>[!Important] Question 1.2
>Now, change your current directory back to your `csci205_jams` folder. What is the full path to your `csci205_jams` directory?
For example, your answers might look like this:

8. **Use the `find` command**
Run the following at the shell prompt:
<!-- markdownlint-disable MD014 -->
```bash
$ find .
```
<!-- markdownlint-enable MD014 -->
>[!Important] Question 1.3
>Copy the output of the above command into `answers.txt`. Be sure it has a file called `answers.txt` listed! If the directories aren't there, or if the file was not created in the right place, then go back and fix it!
9. **Use the `ls` command**
Run the following at the shell prompt:
<!-- markdownlint-disable MD014 -->
```bash
$ ls
```
<!-- markdownlint-enable MD014 -->
>[!Important] Question 1.4
>Copy the output of this command into `answers.txt`. You should only see the `src` directory listed.
10. **Learn About Command Options**
The `man` command (short for manual) is a really useful command to get access to the entire repository of help pages for Linux commands (among many other things).
Let's use it to look up more info about the `ls` command:
- Mac/Linux users:
<!-- markdownlint-disable MD014 -->
```bash
$ man ls
```
<!-- markdownlint-enable MD014 -->
- Windows Git Bash users:
<!-- markdownlint-disable MD014 -->
```bash
$ ls --help
```
<!-- markdownlint-enable MD014 -->
:::info
🔧 **Navigating Help Pages**
- SPACEBAR: Next page
- ENTER: Next line
- UP/DOWN ARROWS: Move one line at a time
- 'q': Quit and return to prompt
:::
>[!Important] Question 1.5
>After reading the help documentation, explain:
- What does the `-l` option do?
- What does the `-a` option do?
11. **Try These Options**
>[!Important] Question 1.6
>Execute this command and copy its output to `answers.txt`:
<!-- markdownlint-disable MD014 -->
```bash
$ ls -la
```
<!-- markdownlint-enable MD014 -->
12. **The Mystery of the Dots**
>[!Important] Question 1.7
>Looking at the output from the previous command, you might see files that start with a dot (.). What are these special files called? (If you don't see dot files and want to see dot files you can try `ls -la ~` to see your home folder)
13. **Learn About File Operations**
>[!Important] Question 1.8
>Two more essential commands are `cp` and `mv`. Use the man pages (or --help) to learn about these commands, then explain in your own words what each command does.
🎯 **Active Learning Required**
You must start becoming self-aware regarding your own understanding and comprehension of everything in this course. If you are told to do something that is unfamiliar to you, then use Google to find answers to what you do not understand. Remember, _active learning_ will be an important component of this course. Just because we do NOT ask you to write an answer to something does NOT mean you are not responsible to understand what it does.
:::info
🔧 **Learning Tip**: Using Man Pages
Learn to use the man pages to look up Linux commands. (Windows users using git-bash will not have man installed. Log into the Linux system, open a terminal, and try out the man command there):
<!-- markdownlint-disable MD014 -->
```bash
$ man *cmd* # Bring up the help page for the command *cmd*
$ man –k *term* # Search man pages for occurrences of *term*
```
<!-- markdownlint-enable MD014 -->
:::
## Practice Questions Summarized
These are the same questions as in the previous section. They are just summarized here for your convenience.
Complete these questions in your `answers.txt` file:
1. **Directory Navigation**
- (1.1) What is the full path to your home directory? (Use `cd` then `pwd`)
- (1.2) What is the full path to your `csci205_jams` directory?
- (1.3) Copy the output of `find .` showing your project structure
- (1.4) What is the output of `ls` in your project root?
2. **Command Line Tools**
- (1.5) Using `man ls` (or `ls --help` on Windows), explain:
- What does the `-l` option do?
- What does the `-a` option do?
- (1.6) Copy the output of `ls -la` in your project root
- (1.7) What are files that start with a dot called?
- (1.8) Explain what the `cp` and `mv` commands do
> 🔍 **Checkpoint**: Before continuing, verify:
>
> - All directories are created in the correct structure
> - `answers.txt` exists in the right location
> - You can navigate between directories using `cd`
> - You've answered all questions in `answers.txt` (1.1 through 1.8)