Right-click on the src/main/java directory under the project and create the package edu.emory.cs.utils. Right-click on the utils package and create the Java class Utils:
Add Utils.java to git.
Add the following methods to the Utils class:
Run the program by clicking [Run -> Run]. If you see 5 on the output pane, your program runs successfully.
Testing
Open and add the following configurations (if not already), which would allow you to perform :
Right-click on the directory under the project and create the package . Right-click on the utils package and create the Java class :
Add UtilsTest.java to Git.
Add the following method to the UtilsTest class. Make sure to include all imports:
Run the test by clicking [Run -> Run]. If you see the test passed, your unit test runs successfully.
Submission
Add the instructors as collaborators in your GitHub repository:
Jinho Choi: jdchoi77
Peilin Wu: qualidea1217
Jeongrok Yu: jeongrok
2. Commit and push the following to your GitHub repository:
3. Submit the URL of your GitHub repository to Canvas.
Although Java 17 is not the most recent version, it is the latest long-term support (LTS) release, which is preferred.
Version Control
Install Git using any of the following instructions:
Run the following commands on a terminal by replacing user.email and user.name with your email address and name:
Integrated Development Environment
Install the latest version of on your local machine:
The recommended version: 2022.3.x (Ultimate Edition)
Apply for the with your school email address to use the ultimate version.
Even if you already have an IDE that you are familiar with for Java programming, we strongly recommend you use IntelliJ because provides IDEs for many popular programming languages with similar interfaces, which makes it easier for you to adapt.
Project Management
Launch IntelliJ and create a project by clicking the [New Project] button at the top:
Name: dsa-java
Location: local_path/dsa-java
Check "Create Git repository"
For JDK, you should be able to see version 17 if it is properly installed. If you cannot find the version, click [Add JDK] and select the following directory.
Windows: C:\Program Files\Java\jdk-17.x.x
Open and make sure distributionUrl indicates the latest version of Gradle:
Click [Settings - Build, Execution, Deployment] on the menu:
Click [Build Tools - Gradle] and set Gradle JVM to 17.
Click [Compiler - Java Compiler] and set Project bytecode version to 17.
Click [File - Project Structure] and select [Project Settings]:
Click [Project Settings - Project] and set SDK to 17 and Project language level to SDK default.
Click [Project Settings - Modules - Dependencies] and set Module SDK to 17.
Open and make sure sourceCompatibility and targetCompatibility are set to java version 17 (add the following configurations if they do not exist already):
Lastly, check mavenCentral() is configured as a repository in your build.gradle:
There is another popular build tool called . However, we will use Gradle for this course because it is faster and simpler to build a Java-based project.
GitHub Integration
To integrate the project with your repository, click [Settings]:
Choose [Version Control - Github] on the left pane.
Click [+] and login with your GitHub ID and password.
If you use two-factor authentication, log in with your .
Create under the project and add the following contents:
Click [Git - GitHub - Share Project on Github] and create a repository:
Make sure to check private.
Repository name: dsa-java
Remote: origin
Add all files and make the initial commit. Check if the repository is created under your GitHub account: https://github.com/your_id/dsa-java.
We recommend you create a GitHub account with your school email address, allowing you to add unlimited collaborators to the repository.