Lab 1: setting up your computers and accounts
Objectives
- Installing required JDK and an Integrated Development Environment (IDE) for Java
- Setting up your submitserver accounts
- Signing up for LeetCode
Installing Java and VSCode on your laptops [20 min]
Follow these instructions to get Java and VSCode (our text editor for code) installed on your laptops; you will need this for your homework assignments.
If you already have a text editor you prefer to use at home, you can skip this step. Just be aware that the testing center machines do not allow you to install software and will only provide VSCode.
Turn off AI features of VSCode
In part because the testing center laptops will not allow you to use CoPilot (an agentic chat that people can use to generate code), please make sure you turn off (or do not enable) this tool in VSCode. There is a CoPilot icon you can click on and choose to disable it. Ask a TA for help if you can’t find it!
Running your first Java file on your computer [20 min]
Let’s use terminals and navigate to a certain directory.
- Use whatever you normally use to create a folder called
CS1111
somewhere you’ll remember on your computer. Don’t put a space in the folder name. - Type
pwd
in your open terminal and hit enter. This will show you the path of the current directory you are on in your terminal. If thepwd
command isn’t recognized, you are running a version that already shows the full path by your cursor, so you can skip this step. - Now type
ls
on Mac (ordir
on Windows) and hit enter. This will show you all the sub-folders from the current directory. - In VSCode, open a new file called
Hello.java
in that folder, and copy-and-paste the Hello World example code below into it:
public class Hello {
public static void main(String[] args) {
// generate some simple output
System.out.println("Hello, World!");
}
}
Make sure the filename is spelled and cased exactly like we show here.
- Using the
cd
command in the Terminal (which stands for “change directory”), typecd FolderName
whereFolderName
is the full path of where yourCS1111
folder lives. For example, on my machine the full path of my folder, which I chose to save underDocuments
, isC:\Users\Dr_Kinga\Documents\CS1111
. You can figure out what the correct path is by navigating through Finder (on Mac) or Windows Explorer (on Windows). In Windows Explorer, you can click on the path at the top of the window and it will convert it into the required format. On Mac, you may need to manually navigate through the folders, typing them as you go. You can also directly navigate the folders in the terminal itself by doingcd
into a new directory, then typingls
/dir
to see what its subfolders are, and repeat until you arrive in theCS1111
folder. - Check that you are in the directory were you saved
Hello.java
; you should be able to see the file in the current directory when you dols
/dir
. - Type
javac Hello.java
and make sure there are no errors. If it looks like nothing happens, everything compiled successfully! If not, ask a neighbor or raise your hand for help. - Type
java Hello
and verify that the stringHello World!
is output to your terminal. If not, ask a neighbor or raise your hand for help. - Take a screenshot of your terminal showing
Hello.java
successfully compiling and running in the same image. Submit this to BB under the“Lab 1 partB”
link.
Signing up for LeetCode [2 min]
LeetCode is a website that contains a large database of coding problems of varying difficulty. It is commonly used by software developers and their employers during the interview process (many people I know have gotten LeetCode questions during their live coding session, myself included!). For this class, you’ll be able to solve some of the easier problems by the end of the semester. After this class, it’s a great resource for more coding practice. Especially in summers and breaks, I would plan to work on about three such problems a week for your four years here to add towards those 10,000 hours :-)
You can sign up for a free account on their website.
Making a submission to the submitserver in the testing center [rest of lab]
Move this laptop to the side (so you can still see the instructions) and open the testing center laptop (you can find this behind the monitors in the lab). Feel free to connect the mouse to that laptop. We’re going to make sure that you are able to login to the machine, login to the submitserver, download an assessment, compile and run the file, upload it to the submitserver, and make sure it grades it.
- Login to the testing center laptop by clicking the
student
account (there is no password). You just need to type that single word where it saysUsername
. This will be how you always login to these machines. - These laptops are Windows machines that are running the Linux operating system. To access a program (application), hit the windows button (looks like four rectangles) at the bottom-left of your key and open the Firefox web browser. Note that these laptops are not connected to the general internet! You only have access to the submitserver on them, and you will need to manually type in the address below into your browser:
https://submit.cs.seas.gwu.edu/
- Click on the link at the bottom of the page above to
Reset Password
; the professor has already setup accounts for you using your emails. Make sure you use with your @gwu.edu (not @gwmail.edu) email address in order for it to find your account when you set your password. - Wait for the confirmation email on your laptop. Once you have received it, you can move to the next step.
- Login to the submitserver on the testing center laptop and navigate to the Lab 1 assignment. Click on the link to download the Lab1 starter code.
- In the folder where you downloaded the file, unzip the tarball with the following terminal command:
tar -xvf lab1_starter.tar
- In that folder, you should see a file called
Lab1.java
. Open it in VSCode and follow the instructions to modify the file and upload it back to the submitserver as your first submission (for participation credit out of 2 points). You can leave the classroom when you’ve finished this step – see you tomorrow! This is Part C of this assignment. Don’t forget to finish parts A and B above if you haven’t aready!
Submission
If you didn’t finish the lab during the lab session, you have until 11:59pm tonight to submit it at home. Don’t forget to submit the two parts to BB as well as the final part to the submitserver for full credit.