Question

Boot into your Linux partition (or open Linux in a VirtualBox VM). You will create a...

Boot into your Linux partition (or open Linux in a VirtualBox VM). You will create a new directory in your home directory called csci2020u/lab02. We’ll add this folder to the Git repositories. Use the following steps to complete this lab:

1. Change into the csci2020u directory

2. Make a new directory, called lab02

3. Add the lab02 directory to Git

4. In the lab02 directory, create the directory structure used by Gradle (the files will be initially empty, you can create them with the touch command):

lab02 → build.gradle → src     → main    → java       → csci2020u      → lab02    → SimpleTest.java

5. Modify the build.gradle file to allow compilation and running of a Java program

6. Create a .gitignore file to ignore files that are normally not committed to a repository (e.g. .class files)

7. View all of the available Gradle tasks added as a result of the change

8. Add some code to the SimpleTest.java file; a simple hello world will suffice, but be sure that the package name matches the directory structure

9. Compile the code

10. Run the code by hand by changing to the build directory and using the java command

11. Commit changes locally, and push all changes to the remote repository

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Create directory structure: csci2020u/lab02

1. mkdir ~/csci2020u/lab02

2. cd ~/csci2020u/lab02

3. git init

4. mkdir -p src/main/java/csci2020u/lab02

5. touch build.gradle

6. add following line into build.gradle file apply plugin: 'java'

7. Modifying build. gradle file to support compilation and running of java project

8. create .gitignore file

Sample .gitignore file:

# Java build artifacts class files

*.class

#other folders

bin/

build/

gen/

#OSX files

.DS_Store

9. View all gradle tasks by simply running the following command in lab02 directory

gradle tasks

10. Add the file SimpleTest.java in folder ~/cssi202u/lab02/src/main/java/csci2020u/lab02 and add code to SimpleTest.java

SimpleTest.java:

package csci2020u.lab02;

import java.io.*;

import java.util.*;

public class SimpleTest{

public static void main(String[] args){

/*Print Hello World*/

System.out.println("Hello World!");

}

}

11. add build file in ~/cssi202u/lab02 (this is known as build directory)

vi build.gradle

add following lines to build.gradle

apply plugin: 'java'

apply plugin: 'application'

mainClassName = 'csci202u.lab02.SimpleTest'

12. Compile the code using this command in build directory

gradle build

13. Run the code using command

gradle run

14. You should following output:

$gradle build BUILD SUCCESSFUL in 0s 5 actionable tasks: 4 executed, 1 up-to-date $gradle run Task :run Hello World! BUILD SU

15. Add the files to staging area

git add *

16. Commit the files locally

git commit -m "initial commit"

17. Push the code changes to remote repository

git push origin master

Add a comment
Know the answer?
Add Answer to:
Boot into your Linux partition (or open Linux in a VirtualBox VM). You will create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • GIT questions Charly and Danny are working in parallel on a coding project from different computers,...

    GIT questions Charly and Danny are working in parallel on a coding project from different computers, but sharing the same remote repository. Charly just changed several files and performed a 'git commit' in his working directory. Danny then performs a 'git pull'. Can Danny see the changes that Charly did? Explain your reasonings. While programming in java, whenever you compile your code you create a massive amount of ".class" files. You want your repository to be as maintained and clean...

  • 1 What is a difference between override and new when it comes to inheritance? 2 What...

    1 What is a difference between override and new when it comes to inheritance? 2 What is the difference between List<type> and ArrayList? AND Which one should you use and why? 3. If I have a file test.txt, and have committed it to the git repository using: $ git commit test.txt Then made some changes, what command (or option) do you use to get the original file back (ie restore the contents of the committed file)? 4 What command (or...

  • Using only shell commands, create a directory structure in your Linux file system to organize files...

    Using only shell commands, create a directory structure in your Linux file system to organize files for this course. An example structure may look like the following: osweb homework homework1.c homework2.java homework3.cpp labs lab1 setup.txt projects Include the following by only using shell commands: List the contents of a directory Write data to a text file Print the contents of a text file to the terminal Delete a text file Move a text file to a different directory Rename a...

  • Using Kali Linux, the Windows Linux Sub-System, or another Debian based Linux distribution, perform the following...

    Using Kali Linux, the Windows Linux Sub-System, or another Debian based Linux distribution, perform the following tasks based on the Linux Fundamentals lecture. For this lab, take screenshots for all major steps completed to illustrate that each task was successfully completed the same method as would be used for other labs). Tasks: 1. Create a new user named Billy Bob using the command linter face 2. Add Billy Bob to the sudoers group 3. Update and upgrade your Linux distribution...

  • Select your answer from here. absolute pathname to the file called xyz changes the directory to...

    Select your answer from here. absolute pathname to the file called xyz changes the directory to the parent of the current directory. lists current directory files including the invisible files sends xyz file to the line printer deletes the directory called xyz displays the content of the file called xyz displays the current directory pathname cancels the printing job on the 1p 1 printer confirms the deletion of the xyz file before deleting it lists the current directory in long...

  • Which of the following tells git that you want to track a particula my File,js in...

    Which of the following tells git that you want to track a particula my File,js in the repository? file name 5. a. git init myFile.js b. git add myFile.js c. git commit my File.js d. git push myFile.js https://mygit.com/myuser/myrepo) that we want to refer to as backuprepo" to our local git, we would use the command a. git remote backuprepo https://mygit.com/myuser/myrepo b. ь, git add backuprepo https://mygit.com/myuser/myrepo c git add backup backuprepo https://mygit.com/myuser/myrepo d. git remote add backuprepo https://mygit.com/myuser/myrepo e...

  • Please help with this linux lab. Please include screenshots as I keep getting errors when I...

    Please help with this linux lab. Please include screenshots as I keep getting errors when I attempt this lab. Thank you in advance Example 1 Enter the system root directory cd / pwd [this command prints working directory] Here is how to go back to your home directory: cd ~ pwd Example 2 Use the Change directory command cd /labs/lab1/ohio inside the ohio folder use the Touch command to create a file called ohiostate.txt /labs/lab1/ohio/touch ohiostate.txt Use the pwd and...

  • (In Linux) 1. Create a file to write to from your script and save it as...

    (In Linux) 1. Create a file to write to from your script and save it as “.txt”. 2. Write the following information to the file that you created in Step 1: Today's date Your full name Your student ID The name of your course What directory you are in File permissions of the file that you created that allow everyone to read, write, and execute The long list of files in your current directory, providing all items and their process...

  • Cybersecurity Fundamentals Lab #9: Access ControlName: ____________________ If your Kali VM is already up and running,...

    Cybersecurity Fundamentals Lab #9: Access ControlName: ____________________ If your Kali VM is already up and running, login to the root account on the VM via ssh. It does not matter whether you use a command line or GUI sshclient. If your VM is not currently up, use the vSphere web client to start your VM before logging into it via ssh.1: Create an Unprivileged User For some labs, including this one, we will need a non-root user account on the...

  • This is done in Linux terminal. Modify the .bashrc file using command line which would add...

    This is done in Linux terminal. Modify the .bashrc file using command line which would add the following functionality to your shell upon opening a new terminal: 1. Alias called “fc” (short for “folder contents) invoking the command “ls -lah”B. Welcome message “This is demo number 7” C. Variable “semester” being equal to “Winter 2020” and print the value on screen 2. Create any directory of your choice and add it to PATH variable. 3. Show an example of local...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT