--- title: "Jam 01 - Exercise 1 - IDE Setup & Configuration" tags: - 3 ๐Ÿงช in testing - 4 ๐Ÿฅณ done - jam01 - ide - intellij created: 2025-01-20 updated: 2025-01-20 --- <!-- markdownlint-disable line-length single-h1 no-inline-html --> <!-- markdownlint-configure-file { "ul-indent": { "indent": 4 }, "link-fragments": {"ignore_case": true} } --> # Exercise 1 - IDE Setup & Configuration {%hackmd dJZ5TulxSDKme-3fSY4Lbw %} ## Overview - Exercise 1 IntelliJ IDEA is a professional-grade Java development environment used widely in industry. While it may seem overwhelming at first, mastering IntelliJ will significantly boost your productivity. This exercise introduces key features you'll use throughout the course. ## IntelliJ Resources Before diving in, skim these essential resources: - [IntelliJ Keyboard Shortcuts PDF](https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf) (bookmark this! print this! whatever you need to do to make sure you have it!) - [JetBrains IntelliJ Documentation](https://www.jetbrains.com/help/idea/getting-started.html) - [IntelliJ Video Tutorials](https://www.youtube.com/@intellijidea) ## Required Steps - Getting Started 1. **Launch IntelliJ IDEA** - **For Linux Users:** - Open a terminal - Type `idea &` at the shell prompt - The `&` runs IntelliJ in the background so you can still use the terminal - Be patient - IntelliJ may take several seconds to load - **For MacOS/Windows Users:** - Launch IntelliJ like any other application from your system menu - **For All Users:** - If asked to import settings from a previous version, select "Do not import settings" - Click "OK" 2. **Initial Configuration** - You may see a "Data Sharing" prompt - this choice is up to you - **Windows Users Only:** - If Windows Defender Firewall prompts you, select "Allow access" - From the Welcome screen (i.e., the first screen you see when you open IntelliJ): <br/>![IntelliJ Learn](https://www.dropbox.com/scl/fi/aphmuii9ucvwwkrugldzt/IntelliJ-Learn.png?rlkey=i5mlvrrpygafnp4rus4bi4fhj&raw=1) - If you don't see the Welcome screen because you are already in a project, select File -> Close Project. 1. Click "Customize" 2. Select your preferred color theme (Dark or Light) 3. Click "All settings..." at the bottom 4. Browse settings but don't change anything yet 5. Close the settings window - **Windows Users Only:** - Configure Git Bash as terminal: 1. Go to Customize > All settings > Tools > Terminal 2. Change Shell path to Git Bash location 3. Usually: `C:\Program Files\Git\bin\bash.exe` :::info ๐Ÿ”ง **Optional but Recommended Settings** - Disable auto-reopening of last project: 1. Customize > All settings 2. Appearance & Behavior > System Settings 3. Uncheck "Reopen projects on startup" ::: > ๐Ÿ” **Checkpoint**: Before continuing, verify: > > - IntelliJ launches without errors > - Your preferred theme is set > - Windows users: Git Bash is configured as terminal > - Settings are saved ## Learning IntelliJ IDEA IntelliJ provides interactive tutorials to help you learn its features. Let's work through some essential ones. 1. **Access the Tutorials** - From the Welcome screen (i.e., the first screen you see when you open IntelliJ), select "Learn IntelliJ IDEA" - Under "Learn IDE Features", click "Start Learning" - **Windows Users Only** - If Windows Defender prompts about paths, select the notification icon - Click "Automatically" - Allow any additional Windows security prompts 2. **Complete Essential Tutorials** Work through these tutorials in order: 1. "Onboarding tour" 2. "Essentials" 3. "Editor basics" Then, as time allows, explore the remaining tutorials. While not required, investing time in learning these advanced features is highly recommended. IntelliJ is the most popular IDE in professional development for good reason - its powerful tools can significantly boost your productivity and make coding more enjoyable. The skills you learn here will serve you well throughout your programming career. 3. **Wrap Up** - If you finished the required tutorials and are ready to move on, close any open tutorials and return to the Welcome screen. :::warning ๐Ÿšง **About Tutorial Projects** - Tutorials create temporary projects for practice - These are separate from your csci205_jams work - If you see warnings about annotations, click "attach annotations" ::: ## Essential IntelliJ Features Here are the most important features to learn right away: ๐Ÿ”ง **Learning Tips** - Print the [IntelliJ Cheat Sheet](https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf) - Keep it at your desk for reference - Focus on learning a few shortcuts at a time - Practice shortcuts as you code > ๐Ÿ” **Checkpoint**: Before continuing, verify you: > > - Completed the basic editor tutorial > - Can use at least 2-3 keyboard shortcuts > - Know how to expand code templates with Tab ## Setting Up Your Class Template :::info ๐Ÿ”‘ **Note About Project Context** From here on, most instructions will assume you're working within your open IntelliJ IDEA project (i.e, not at the welcome screen). ::: Let's configure IntelliJ to automatically add our standard CSCI 205 header to new Java files. 1. **Open Template Settings** - Select File > Settings (or Ctrl+Alt+S) - Navigate to Editor > File and Code Templates - Under "Files", select "Class" 2. **Add the Template** ```java /* ***************************************** * CSCI 205 - Software Engineering and Design * Spring 2025 * * Name: YOUR_NAME * Date: ${DATE} * Time: ${TIME} * * Project: ${PROJECT_NAME} * Package: ${PACKAGE_NAME} * Class: ${NAME} * * Description: * * **************************************** */ #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end public class ${NAME} { } ``` 3. **Customize Your Template** - Replace `YOUR_NAME` with your actual name - Leave the other variables (like `${DATE}`) as they are - IntelliJ will fill these in automatically - Click "Apply" then "OK" :::info ๐Ÿ”ง **Template Guide** - **Variables Used:** - `${DATE}` - Current date - `${TIME}` - Current time - `${PROJECT_NAME}` - Name of your IntelliJ project - `${PACKAGE_NAME}` - Package where the file is being created - `${NAME}` - Name of the class you're creating - **Important Notes:** - This template is specific to CSCI 205 - You can modify it after the course ends - Keep a backup of the template text ::: ## Save Your IntelliJ Configuration Now that you've configured IntelliJ with your template and settings, let's make sure these configurations are properly saved in your repository. 1. **Check Repository Status** ```bash git status ``` You might see something like: ```bash Untracked files: (use "git add <file>..." to include in what will be committed) .idea/ ``` :::info ๐Ÿ”‘ **Understanding Git Status** - The .idea folder contains your IntelliJ configuration - Red files are untracked or modified but not staged - If you don't see .idea files, you may have committed them in Jam00 - All project files should typically be tracked unless explicitly ignored - If you're working on files not part of the assignment, they probably shouldn't be in this folder - Some .idea files are personal to your computer (like workspace.xml) and are listed in .gitignore - We only stage/commit configuration files that would be useful in a team environment ::: 2. **Save IDE Configuration** - If you see .idea files: ```bash # Stage important config files git add .idea # Commit them git commit -m "jam01: Save IntelliJ configuration" ``` - If you don't see them, they're already tracked - great! :::warning ๐Ÿšง **Repository Best Practices** - Always run `git status` before and after making changes - Understand why each file appears in `git status` - If you're not committing a file, have a good reason - Keep your repository focused on course work ::: > ๐Ÿ” **Checkpoint**: Before continuing, verify: > > - You understand what git status shows > - Your IDE configuration is saved > - Your working directory is clean > > ![Clean Jam01 direcotry](https://hackmd.io/_uploads/ry_94mKOJx.png)