Setting up Eclipse and Running Our First Java Program on a Mac
After you downloaded the Eclipse package you’ll find it inside your downloads folder so open up your download folder and double-click the Eclipse file and it’s going to create a application that you’ll then want to drag and drop to your Applications folder or to your desktop or you can keep it inside the Downloads folder. You can also add this icon to the dock so you can easily access it. I’m going to minimize some of these windows so you can see the first time that i launched it, it asked me if I’m sure I want to open it because it’s downloaded from the Internet. Say yes. Sometimes, depending on your security settings, it won’t let you open the file because it’s from an untrusted or an unidentified developer. And if that happens for you, you’re going to go to your system preferences, going to go to security and privacy and you’ll click the lock to make changes you’ll type in your username and password and then you’ll see an option here to allow you to open eclipse anyway so you can just click that button and then go back and click on the icon and it will open up. Whenever you first open Eclipse is going to ask you to find your workspace. This is where it’s going to save the files at. So i’m going to change my workspace and create one called a CIS 171 folder. Keep it in my documents and create the folder here and use this instead just so i can keep my work for my different classes separated and then i’ll click ok. The first time that it launches you brought to an overview screen. You can get an overview. You can check out some of the samples or walk through some of the tutorials. We’re just going to do a very basic java project so that we can verify that your system is up and running so let’s close out of this and we’re going to create a new java project and i’m going to call it “HelloPrinter”. I’m going to leave all these as default right now we’ll talk about these as we go into the course and click finish. Now i’m going to create a class. I’m going to put the name in here to create this new Java class i clicked this create class button here. If you go under new file new you can create a Java class there. I’m going to leave everything is default here. Click finish and now it’s created my class called ‘HelloPrinter’. To verify that our system is working we’re going to implement the java code on page seven in your textbook so if you want to pause this video and type out the code and page 7 you can go ahead and do that now. I’ll assume that you’re finished typing in the code. We’re going to compile and run this and you learn more about what it means to compile and run in our first lesson but for now we just want to verify that your Eclipse is working with java. So to compile and run this, we need to save it and then eclipse will do the compiling and the running for us. Up here there’s a green play button. I’m going to click that and that will run our program. It’s going to ask us which program or which files we want to save and we want to save this one will go ahead and click OK and now it’s saving, compiling it and running it and if we look down here you’ll see there’s a console and in here you’ll see our note. If you received an error, take a look to make sure that you have things capitalized correctly – the S in system and that capital S in string – that does matter. Another place to check for common errors are these curly brackets. Make sure that you’ve got those in there correctly – the opening and closing of them and then lastly a lot of people will leave off the semicolon at the end or even forget the double quotes in here so just double check to see if you’re getting an error message what that might be. You can make changes and then save and compiled again. For your first assignment, you want to take a screenshot of this with the app running with the Eclipse running with your .java file here and then finally with “hello world” showing in your console. Before you do that though let’s add in a comment with your name so that i can verify that this was your work on your system so we just put two slashes and then put in whatever we want to and that is how we write comments and java. Go ahead and compile, run it again now take my screenshot and i’ll submit that in the assignment in our getting started folder.