Java and the Eclipse IDE

  1. Eclipse IDE Lesson
  2. Help with Eclipse
  3. Citrix FAQs

A Quick Lesson on the Eclipse IDE

Getting the Eclipse IDE

If you feel adventurous, you could also setup your own IDE development environment such as Eclipse, NetBeans, or the regular JDK to develop your programs on your own PC. However, please be aware that if you download your own copy for your own computer, you will be on your own without support for any installation problems as well as for any troubleshooting problems. Installing your own distro and/or Java development environment is certainly an excellent pedagogical tool but ONLY if you are willing to do your own support.

That being said, if you do feel ambitious, here are two excellent videos showing how to download and run Eclipse for Java: http://www.youtube.com/watch?v=CE8UIbb_4iM and https://www.youtube.com/watch?v=35NUuhmQuB4. The steps, in brief, are as follows:

  1. Install the Java JDK so you have the Java compiler and Java virtual machine ready to go. To install the Java compiler and virtual machine, install the Java Development Kit (JDK) SE as follows:
  2. Download Eclipse IDE for Java Developers
  3. Extract from the zip folder into a folder of your choosing

Helpful Links for Installing/Using Eclipse

Some good links for getting and using Eclipse:

Eclipse IDE Organization

The Eclipse IDE organizes your Java source code using the following hierarchy:
  1. Workspace – a folder containing Java Projects
  2. Projects – a group of Packages
  3. Packages – a group of classes
  4. Classes – your source code file(s)
  5. Console – to display your printed output and accept the user's input

Eclipse User Interface

  1. EDITOR: Placed in the center, the editor is the heart of eclipse.
  2. PACKAGE EXPLORER: The package explorer gives an overview of the projects and their contents. Close projects you currently don't need to keep Eclipse fast. If your project content isn't displayed in the correct way (with packages, referenced libraries, etc.), you are likely in the wrong perspective (see point 5 below).
  3. OUTLINER: The outliner shows the structure of the selected class. Use the sorting and display properties at the top to modify the view. By clicking on a list item, the cursor in the editor will move to the selected property or method. Also available are the import declarations, which reference the other classes your classes/objects need to work.
  4. CONSOLE/PROBLEMS: If the Eclipse IDE thinks that your code needs some work, it will leave you a detailed message in the Problems tab. Also in this part of the screen, the Console will print the print and println commands used in your Java source code.
  5. SWITCH PERSPECTIVES: In the upper right part of the Eclipse IDE you are able to switch to other perspectives. Each plugin (mostly for other programming languages) has its own rendering mode for Eclipse. You can switch perspectives by either choosing Window → Open Perspective → Other or by clicking the buttons at the far right on the toolbar.

How to Create New Projects

  1. From the File menu choose: New -> Java Project
  2. Use the default project settings and press the Next button; the Java Settings dialog box will appear.
  3. The Java Settings dialog box allows you to configure the build settings for your project.  Use the default settings and press the Finish button.

The Workbench, Tabs, and Perspectives

  1. Different informational tabs can be display within the IDE.
  2. The area where tabs are displayed is called the workbench.
  3. To see a list of available tabs select the Window menu and then the Show View item.
  4. The tabs displayed within the IDE’s workbench are called a perspective.  You can customize your workbench with your favorite tabs and save the arrangement as a customized perspective by Using the menu item Window > Save Perspective As.
  5. Or, you can use Eclipse’s predefined perspectives.  The predefined perspectives include Debug, Java and Java Browsing.  The Java Browsing perspective is interesting because it provides a tab display of Projects, Packages, Types (classes) and class members. Clicking on an item in a ‘parent’ tab will display items in the ‘child’ tab.  For example, clicking on a package name in the Package Tab will display the package’s classes in the Types tab.

How to Add a Package to a Project

  1. Select your Project from the Package Explorer Tab
  2. Right-Click on the Project and choose New -> Package
  3. Assign the package a meaningful name and press finish

How to Add a Class to a Package

  1. Right-click on the package to which you intend to add a class
  2. Choose New -> Class from the menu
  3. In the New Class dialog box assign the class a name
  4. Include a method stub for public static void main(String[] args)
  5. There is no need to change any of the other options. Press the Finish button

Enter your Source Code into a Class Source Code File

  1. Select the source code file you wish to open (the extension is .java).
  2. Right-click on the file and from the menu choose Open
  3. Modify and save your source code

How to Execute Your Code

  1. Press the Arrow button in the Tool bar or choose Run from the Menu Bar. You can also use the key combination ctrl-F11.

How to Debug Your code

  1. Set break points by right-clicking in the right-hand blue margin of the source code editor and choose Toggle Breakpoint.
  2. Start the debugger by pressing the F11 key
  3. When a break point is reached you can:
    1. Step into (F5)
    2. Step over (F6)
    3. Resume Execution (F8)
  4. A variable’s value can be viewed in the Variables Tab or by hovering your cursor over the variable.
  5. You can copy and paste code into the Expressions Tab to view the result of an expression or the value of a variable.
  6. In the source code editor syntax errors are underlined in red.
  7. Hovering your cursor over the underlined text will display a context sensitive dialog box with suggestions on how to fix the error.

Help with Eclipse

  1. EXCELLENT video showing how to download and run Eclipse for Java: http://www.youtube.com/watch?v=CE8UIbb_4iM
  2. For Eclipse: Go back to the eclipse welcome screen and try the helloworld tutorial. This really helps you with navigating through eclipse.
  3. Eclipse offers an excellent documentation and tips which can be found within the help menu.
  4. Refer to the online documentation at the Eclipse website.
  5. Google the terms Eclipse and Java.  There are many flash tutorials and websites online.
  6. C++ vs. Java: http://www.computing.dcu.ie/~renaat/projects/cvjava.html
  7. Search Youtube.com using the terms Eclipse and Java.
  8. Video Tutorials on using the Eclipse IDE

Citrix FAQs


Ricky J. Sethi, PhD <rickys@sethi.org>
Last updated: Friday, January 16 2015
(www.sethi.org/tutorials/tutorial-using_eclipse_ide.shtml)