logosetup
Return to SetUp Menu |  JavaBitsNotebook.com | MathBits.com | Terms of Use  | JavaMathBits.com

Things to Remember about Eclipse!

Create a New Project:
1. Pull down the FILE menu

2. Select NEW

3. Select Java Project

4. When the "New Java Project" box appears, enter your "Project name" such as Assignment1.

5. Be sure "Use default location" is checked.

6. In the JRE section, choose the last radio button, "Use default JRE
(currently 'jdk1.8.0_91")

7. In the Project layout default to "Create separate folders for sources and class files".

8. Select "Finish".

The Package Explorer (on the left panel) shows your recent projects. Create a new project for each of your Java projects.
Write Your Program:
1. In the Package Explorer in the left panel, right click on your new project name.

2. OR pull down the FILE menu

3. Select NEW

4. Select CLASS

5. When the "Java Class" box appears:
• leave the "Package" entry blank.
• the "Name" will be the name of your program, NOT your project name.
• leave the "public" radio button checked.
check "public static void main(String[] args)" box.

6. Select "Finish"

7. Your source file "name.java" will open on the center editor panel.

8. Type your code.
   
run Execute the Program:
1. In Eclipse, the Java code is compiled as it is entered.

2. If your program is error free, you are ready to run.

3. To run the program, right click anywhere on the center editor panel.

4. OR choose the Run menu.

5. Choose "Run As".


6. Choose "Java Application".

7. The output of your program will appear in the bottom Console panel of the screen.
If you have more than one program in the same project, each with a main() method, right click the source, choose "Run As", Java Application to run that source file. Choosing Run runs the recently run program.
Debugging Errors:
There are 3 types of errors:
• Compile-time errors - syntax errors
• Logic errors - "bugs"
• Run-time errors - ie, ÷ by 0

In Eclispe, a red X will appear in the editor window to the left of the line that contains the error.
The red X may appear "as you type". Ignore them until you are finished typing the code.
A single click on
red X will display the error message. A double click will give additional information.
   
Save .java file to flash drive:
(from your workspace)
1. Write the .java code in Eclipse.

2. Open your workspace folder.

3. Choose the Project name folder.

4. Choose the src folder.

5. Your .java file is here. Save to flash drive.
Import .java file from outside Eclipse (flash drive):
1. Create a NEW project where the .java file will be placed.

2. Right click on src folder and choose Import.

3. Choose General, the File System.

4. Browse to the Directory where the .java file is stored. This is just the Directory, not the file.

5. Click on the box in front of the .java file.


6. Click Finish.

7. Under src, and (default Package) is the .java file.
Beware! If you delete a project from Package Explorer, it is NOT being deleted from your workspace folder. Be careful not to name a project with a name that may be in residence in the workspace folder. You will end up with a project inside of a project. Yuck!
   
Close a Project:
In Package Explorer, a blue folder icon means the project is closed. Open by double clicking on it. To close a project (if you have numerous projects aviailable), click on it and select Close Project.
If you cannot see Package Explorer, go to Window, select Show View, and choose Package Explorer.
   
note When you are typing your program, if your cursor has changed from a vertical bar to a black block, you have accidently hit the INSERT key and disabled the Smart Insert Mode (under the Edit menu). If you hit INSERT again, it should reactivate the Smart Insert Mode and return your cursor to a vertical line.

divider
Return to SetUp Menu |  JavaBitsNotebook.com | MathBits.com | Terms of Use  | JavaMathBits.com

Notice: These materials are free for your on-line use at this site, but are not free for the taking.
Please do not copy these materials or re-post them to the Internet, as it is copyright infringement.
If you wish hardcopies of these materials, refer to our subscription area, JavaMathBits.com.
Help us keep these resources free. Thank you.