
Install Git
Download and install Git https://git-scm.com/downloads
Install Netbeans
Download and install Netbeans https://netbeans.apache.org/download/
Accept your Github Classroom Assignment
First use the link given to you to accept the assignment.

Get your Github Classroom Repository URL
Wait for the repository to setup.

Then keep the repository URL for later use.

Start New Project
Start a New Project

Choose Java with Ant > Java Application
Press Next

Type in Project Name
Uncheck Create Main Class
Press Finish

Create a Java Package for Each Practical

Name the First Package to "Practical1"

Create a Java Class in the Package
Make a Class for Each Question.

Name the Java Class "Q1"

Write the Java Class "Q1"

Make the main function print out "Hello World!"
public class Q1
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
Save and Press Run Project

If see No Main Classes Found, ensure you saved the file.
Run the Q1 as Main Class

Ensure it is Working

Go to Project Properties

Copy the Project Folder Location

Go to the Project Folder

Create a Text Document in the Project Folder

Name the Text Document to ".gitignore"

Accept the change of file extension.

Put in the list of files or folder to Ignore by Git

Save the ".gitignore" file

Run Command Prompt

Get the Java Project Folder Location

Go to the Folder Location in Command Prompt

Connect Git with Github
Follow the guide to setup the git https://docs.github.com/en/get-started/quickstart/set-up-git
Set your user name
$ git config --global user.name "USERNAME"
Set your user email
$ git config --global user.email "email@example.com"
Perform Commit to Github for First Time
Run the following Git commands
git init
git add .
git commit -m "First Commit"
git branch -M main
git remote add origin <REPLACE WITH GITHUB URL>
git push -u origin main
You will see the following


You will see its pushed to Github.

Go to Github to Check

Subsequent Commits
You can now work on more questions and commit the changes to Github by running the following git commands
git add .
git commit -m "DESCRIPTION OF COMMIT"
git push
Comments