First, familiar with eclipse
1.Eclipse is an integrated development tool developed by IBM with a $40 million investment. It is written in the Java language and is open source, extensible, and one of the most popular Java integration development tools available today. In addition, IBM donated the Eclipse source code and formed the Eclipse Alliance, which is responsible for the subsequent development of this tool. Eclipse provides programmers with a first-class Java programming environment, and its platform architecture is built on the plug-in concept, which is one of the most distinctive features of the Eclipse platform and one of its distinguishing features from other development tools.
2. Download Eclipse
The steps are as follows:
(1) Open the browser, enter "Http://www.eclipse.org" in the Address bar, press ENTER to start visiting Eclipse's official website, the homepage of the site contains the downloaded hyperlinks, Click the Download menu item on the page or the download Eclipse hyperlink on the right to go to the download page.
(2) The Eclipse download page contains various versions of the Eclipse download area, 3rd of which is Java development version of Eclipse, on the right side of each column is a download hyperlink for various platforms, click the hyperlink.
(3) The final Eclipse download page assigns a reasonable download mirror site based on the location of the client, and the user simply clicks the green arrow on the Eclipse download page to download the eclipse file.
3. Install Eclipse's Chinese language pack
the Eclipse installation file downloaded from the Web site is a zipped package that extracts it to the specified folder and then runs the folder's Eclipse.exe file to launch the Eclipse development tool. However , you will need to install the Chinese Language pack before you start eclipse to reduce the learning difficulty of the reader.
The steps are as follows:
(1 enter "Http://www.eclipse.org/babel" in the address bar of the browser and press ENTER to enter the first page of the Babel project group.
(2) Click on the left side of the page to Hangzhou which downloads hyperlink or click the green arrow below the page to go to the Language Pack download page.
(3) under the Babel Language Packs title of the download page, select the hyperlink download Language pack for the Eclipse version, the name of Eclipse 3.7 is Indigo, so click the hyperlink to go to the Eclipse 3.7 Babel Language Pack download page, In this page, a package is included for each language, and the resource bundle for each language is divided into multiple zip packages by plug-in and function modules.
(4) Find the Language Pack category in Simplified Chinese on the page, you can download the language pack for eclipse individually, or you can download all the language packs. For example, to download the Eclipse Language Pack separately, you can click the Babellanguagepack-eclipse-zh_3.7.0.v20111128043401.zip (87.36%) hyperlink, The file name after download is babellanguagepack-eclipse-zh_3.7.0.v20111128043401.zip.
( 5) Unzip all the downloaded language packs and overwrite the two folders with the same name in the Eclipse folder features and plugins so that the language pack will be loaded automatically when you start eclipse.
4.Eclipse Configuration and startup
Now that you have configured the multi-language pack for Eclipse, you are ready to start eclipse. Running the Eclipse.exe file in the installation folder of Eclipse, starting Eclipse, pops up the Workspace Launcher dialog box, which is used to set the workspace for Eclipse (the workspace is used to save the program projects and related settings that eclipse establishes). Here the development environment unifies the workspace folder where the workspace is the Eclipse installation location, enter ". \workspace" in the workspace text box of the Workspace Launcher dialog box, and click the OK button to start eclipse.
When you first launch Eclipse, the Eclipse Welcome screen is displayed, including an overview of Eclipse, additions, samples, tutorials, and related buttons for the workbench.
5.Eclipse Workbench
In the Eclipse Welcome interface sheet, click the Workbench button or close the Welcome screen to display the Eclipse Workbench, which is the main place for program developer development programs. Eclipse can also seamlessly integrate a variety of plug-ins into the workbench, or you can develop a variety of plug-ins in the work console. The Eclipse Workbench consists mainly of title bars, menu bars, toolbars, editors, perspectives, and related views.
6. Perspective and view
(1) Perspective view
A perspective is an additional organizational layer provided by the Eclipse Workbench, which implements the layout of multiple views and a collection of available operations, and defines a name for the collection, which acts as an organization. For example, the Java perspective provided by Eclipse organizes a collection of views and actions related to Java programming, while the debug perspective is responsible for organizing the view and set of actions related to program debugging. Several common perspectives are available in the Java development environment of Eclipse, such as the Java perspective, the resources perspective, the debug perspective, the group synchronization perspective, and so on. You can switch between different perspectives, but only one perspective is used at the same time.
(2) Views are used to browse the hierarchy of information and to display properties of the activity editor, for example, the console view is used to display output information and exception errors when the program is run, while the Package Explorer view can browse the project file organization structure. Views can appear individually, or they can be overlaid with other views with tab styles, which can have their own separate menus and toolbars, and can be dragged to change the layout position.
7. Menu bar
The Eclipse's menu bar contains basic eclipse commands, and the menu for that editor is added dynamically when using a different editor. The basic menu bar out of the common "file", "Edit", "Window" and "help" and other menus, but also provides a number of function menus, such as "Source code" and "Refactoring", each menu contains different commands, which are used to complete the final operation, such as file opening and saving, code formatting, The operation of the program and the step debugging and so on.
(1) File menu: Contains commands such as new, save, close, print, switch workspace, properties, and so on.
(2) "Edit" menu: for helper code design work, in addition to the commonly used "cut", "copy", "Paste" command, but also provides "quick fix", "Extend selection to" and "content assist" and other advanced commands.
(3) "Source Code" menu: contains all the commands related to code preparation, mainly for auxiliary programming.
(4) "Refactoring" menu: It is the most critical menu for Eclipse, which mainly includes related commands for Project refactoring.
8. Toolbars
(1) Main toolbar: Under the Eclipse menu bar, the content will die first related tool buttons based on different perspectives and different types of editors.
(2) View toolbar
(3) Pivot Chart toolbar
(4) Quick View toolbar
9. The Resource Pack Manager view
This view is used to browse Java elements in the project structure, including packages, classes, class library references, and so on, but the main purpose is to manipulate the source code files in the project.
10. Console View
Used to display output and exception information that the program is running.
Ii. use of Eclipse
1. Create a Java project
(1) file-new-project, open the New Project dialog box, which contains the wizard to create the project, select the Java project node in the wizard, and click the Next button.
(2) Pop up the New Java Project dialog box, enter "Hellojava" in the Project Name text box, select the "Create a separate folder for source files and class files" radio button in the project layout bar, then click the "Finish" button to complete the project creation.
2. Create a Java class file
(1) In the Source folder text box, enter the location of the project source program folder. The wizard will usually fill in the text box automatically, no special case, no need to modify.
(2) in the "Package" text box, enter the package name of the class file, where the default is empty, do not enter any information, so that the Java project will use the default package.
(3) In the Name text box, enter the name of the newly created class, such as Hellojava.
(4) The public static void Main (String[]args) check box is selected, and when the wizard creates the class file, the main () method is automatically added to the class, making the class the main class that can be run.
3. Writing program code using the editor
(1) Open the Java Editor
After you create a Java class file using the wizard, the Java editor is automatically opened to edit the newly created Java class file. In addition, the most common way to open the Java editor is to double-click the Java source file in the Package Explorer view or choose the Open with/Java Editor command from the shortcut menu on the right-click popup in the Java source file. The Java Editor highlights Java syntax in different styles and colors. These highlighted grammars include program code comments, Javadoc comments, and Java keywords.
(2) Writing Java code
The power of Eclipse is not that the editor can highlight Java syntax, but rather its powerful code-accessibility capabilities. When writing Java program code, you can use the ctrl+alt+/shortcut key to automatically complete the keyword, or you can use the alt+/shortcut key to launch the Eclipse Code assist menu.
After using the wizard to create the Hellojava class, the wizard automatically constructs part of the code for the Hellojava class structure, and the main () method, which the program developer needs to do is to complete the code and add the response business logic to the program.
4. Run Java
The Hellojava class contains the main () master method, which is a main class that can be run.
Third, the program debugging
1. Breakpoints
Setting breakpoints is an essential tool in program debugging, where the Java debugger suspends the current thread each time it encounters a program breakpoint, pausing the current program's run.
You can display the location of the code line number in the Java Editor double-click to add or remove the current breakpoint, or right-click the current line number, and select the Toggle Breakpoint command on the popup shortcut menu to add and remove breakpoints.
2. Running Java programs in debug mode
To debug a Hellojava program in Eclipse, you can right-click the Hellojava file in the Package Explorer view and choose the debug mode/Java Application command from the shortcut menu that pops up.
3. Program debugging
After the program executes until the breakpoint is paused, you can perform a response debug operation, such as run, stop, and so on, through the buttons on the Debug View toolbar.
(1) Step skip: Press F6, will perform a single step skip operation, that is, run a separate line of program code, but not into the interior of the bar method, and then transferred to the next executable point and suspend the thread.
(2) but do not jump in: Press the F5 key, the execution step jumps into the internal stepping procedure of the calling method or object and suspends the thread.
Familiarity with Eclipse development tools