Welcome to the first lab of CSCE 145! I would think everyone that made it this far is logged into the machines, but just in case you are viewing this from your phone or something... 1.) Login with your USC username (your email address minus everything after the @, ex. hoskinsw@email.sc.edu becomes hoskinsw) 2.) Your password should be usc-vXXXXXXXX, where the Xs are replaced by your student ID 3.) You will be prompted to create a new password, it needs to be 8 characters with at least 3 of the following: (a) One or more lowercase alphabetic characters (a-z); (b) One or more uppercase alphabetic characters (A-Z); (c) One or more numeric characters (0-9); and (d) One or more special characters, such as !@#$%^&*-+=
Now that we have that finished lets get everything set up First we will need to put our shortcut to our development environment onto the desktop. Note that this is your personal desktop and it will follow you to whatever windows machine you use in this building. The program we are looking for is called Eclipse, you will find it by clicking Start->Programs->CSE Apps->eclipse Right click the eclipse icon (it's a little purple ball, hard to miss) and click "send to" and then "Desktop (shortcut)" Boom, step 1 done, moving on Let's go ahead and open Eclipse, you should see a Workspace selector asking you to pick a workspace What's a workspace Mr. Instructor guy? Well I am glad you asked, tiny text. A workspace is where all of your coding projects are going to be held. Each time you have a lab you will select this workspace and create a new project inside of it (we will get to how to do that shortly). Usually I create different workspaces for different types of projects, so I might have one for each class that I am using Eclipse for or something like that Since it is asking us where our workspace is and we don't have one, if we point it to the directory we want it in and create a new folder it will make that new folder our workspace We should start off by clicking browse, a little window will pop up asking you to select your workspace directory. Go to My Computer and click on the H: drive Why the H: dri Shhh, I got this tiny text, thanks though. The H: drive is your drive, nothing on it will be deleted. On the occasion the department wipes the local information from each machine, anything and everything important needs to go inside the H: drive so you don't lose it! After you click on the H: drive you should click New Directory and name it workspace. Click okay, make sure the little box with the address to the folder says something like "H:\workspace" Click ok and boom, step 2 done When you click ok Eclipse should open and we are almost there! You should have a Welcome tab open, go ahead and close that tab so you can see eclipse in all of it's glory Now that that's done we need to make a new project for the lab, do this by clicking File->New->Java Project Clicking Java Project will pull up a nice window asking you to name the project, for the labs it will probably be best just to do "LabXX", the Xs being the lab number. So for this one do "Lab01", nothing else needs to be changed, just click Finish Now you should see your new project on the left side of your screen in your Package Explorer. If you don't see the Package Explorer click Window->Show View->Package Explorer You see Lab01 there, so go click on your creation so you can see what's in it. You should see a folder "src" (pronounced Source, you will put your code here) and the JRE System Library (not important to know about) If you click on src you will see that nothing is in there, so you have no code. Time to make some code! Right click on src and click New->Class and the New Java Class window will pop up. A class file is just a place to put your code for now, we will get into it more later. We need to name our class, so how about HelloWorld since that is what we are writing today. Everything else should be left alone except make sure that you check the box that says "public static void main(String[] args)", this isn't necessary, but it makes this next part easier. Go ahead and hit Finish A new tab should have popped up with your code, it should say something like:
public class HelloWorld { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
All we need to do now is put some of our own code into there! Remove the "//TODO Auto-generated method stub" line and we will put some code in its place. For this lab all we want to do is print the String "Hello, World" to the screen. Pretty easy, right? To do this we can't just write it out, we have to tell the computer how to print it. We do this by typingSystem.out.println("Hello, World");
The quotation marks denote that this is a String and the semicolon tells the computer that the line of code is finished. Now we need to run this code, click Run->Run or click the green play button in the toolbar If all went correctly you should see your console pop up with the text Hello, World in it! If so congratulations! Otherwise you did something wrong, see if you can figure it out or call a TA over for some help. Once you have it working show it to your TA so they can check you off and then it is time to turn in your code. Every lab will have a submission box on the website http://dropbox.cse.sc.edu Sign in on there with your windows credentials (username and new password you used earlier) and you should see CSCE 145 listed, if not notify a TA. Click on the class and click on "Lab 1", click browse, go find your workspace (it's in the H: drive, remember) and click the lab. Open the src folder and submit the "HelloWorld.java" file in there. After that you are done! Congrats on finishing your first lab, see you on Monday!