Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eclipse Navigation & Usage.

Similar presentations


Presentation on theme: "Eclipse Navigation & Usage."— Presentation transcript:

1 Eclipse Navigation & Usage

2 Intro Now that you have Eclipse setup at home, or you are using it at school we are ready to introduce you to the software. In this presentation you will learn 2 things: How to find key components of the IDE How to work in the environment Creating a new project Writing code Debugging your code Getting a project ready for submission

3 Shows all projects and their files in your Workspace
Package Explorer: Shows all projects and their files in your Workspace Code Editor: All coding will be done in this area Perspective layout: Keep set to Java Compile and Run program (Ctrl+F11)  main code block: write programs here for now Save-All Button (Ctrl+Shift+S) Compile and Run program in Debug Mode (F11) If a tab is missing, click WindowShow ViewChoose desired tab Information Panel: Find important information like compile errors and program output in the appropriate tab

4 A New Project Assuming you have setup your Workspace, any new project will default its creation location to this folder Follow the next few steps to get a basic project ready for editing 1. Click FileNewJava Project 2. Choose a Project Name descriptive of the program’s purpose or title For example, when creating a calculator program you may call it Calculator, whereas for a game you may call it the title of your game like MineSweeper The name must NOT contain any spaces The name must use MixedCase, meaning each word starts with a capital letter, e.g. TheLegendOfZelda 3. Under the JRE section, choose the Use default JRE option 4. Click Finish

5 A New Project - Part 2 You have now created a Java Project, but it is not quite ready to write any code yet. To do this we need to create an entry point for the compiler to start at when building your program for execution. We need to add a new file to our project 1. In the Package Explorer on the Left, click the arrow beside your project name to make its parts visible 2. Right-click the src folder and choose NewClass 3. Since this is our main file we will give it the name Main 4. Check the public static void main(String args[]) box 5. Click Finish, you will see your new file, Main.java open in the editor

6 Writing Our Code For the majority of our programming in this course we will write our code in 3 areas of the Main.java file Area (1): Used for defining Global variables (more on this later) Area (2): Used to write the core logic of the program Area (3): An area to create support blocks of code for later use called Subprograms/Methods (more on this later) 1 2 3

7 Debugging Our Code When our code has an error, we say it has a bug
Bugs can occur while the program is compiling or running A bug during compile-time will show in our Error tab and will not allow the program to run A bug during run-time will crash the program and try to give us a hint in the Error tab as to what and where the bug is, based on line number We can click on any line of code and see what line number it is in the status bar located at the bottom of the screen Here it says we are on line 1, column 1 of the program This is a reactive way to fix our programs, there is a more proactive way, using the debugger tools built into eclipse

8 The Debugger As mentioned before, eclipse will try to tell us where the error occurred, but sometimes we have to problem solve and work our way backwards from the problem. The best tool in the debugging tool box is a break-point. A break-point acts as a pause location in our program. The program will execute as normal from top to bottom, but will pause execution on the line we set the break-point at without executing that line We can add as many break-points as we want From here we can do a few things: We can execute the program one line at a time with the F5 key (F6 as well) We can mouse-over parts of our code to check its current status and value This will help us discover why the bug is occurring

9 Adding a Break-Point Looking at the image on the right we see the highlighted vertical bar To add a break-point, simply double-click on this bar beside the line your would like to break at A little blue circle will appear To remove a break-point, just double-click the blue circle

10 Using a Break-Point To use the break-points you need to run your program in Debug mode using the debug button or F11 key This will put you in the Debug perspective view to give you extra information while testing When done testing, click the red stop square to end debug mode, this box can be found at the top of the screen in the Debug perspective or in the Information panel on the bottom-right side of the screen Return back to normal Java perspective by clicking the Java perspective button in the top right of the screen

11 Prepping for Submission
When you are done working on your project and ready to submit your work you need to take a few final steps to get your project ready 1. In Windows, navigate to your Workspace folder 2. Select the folder containing your project you want to submit 3. Click FileSend ToCompressed (zipped) Folder If you are running a Mac, use the Mac strategy for zipping files 4. This will create a zip file, the file to be uploaded for submission IMPORTANT NOTE: When zipping, and not using the strategy given above, be sure to create a zip file. Not rar or 7z or anything else. The school computers can ONLY handle zip files. No you cannot simply rename it to a zip file, this will break the file.


Download ppt "Eclipse Navigation & Usage."

Similar presentations


Ads by Google