Introduction to Eclipse development tools

Source: Internet
Author: User

Eclipse is a Java-based, open-source, extensible application development platform that provides programmers with a first-class Java integrated development environment (Integrated development environment,ide). A Java EE version of the Eclipse IDE is available on the Eclipse's official website. Apply Eclipse IDE for Java EE, either to create a Java project or to create a dynamic Web project.

1.1 Understanding the Eclipse Workbench
Double-click the file in the Eclipse installation directory to start Eclipse, in the dialog box that pops up the Select workspace, specify the workspace location as shown in the workspace directory under the Eclipse installation directory, 2.1.

Figure 2.1 Setting up a working space
Note: Each time you start Eclipse, a dialog box will pop up to set up the workspace, and if you want to stop working space settings at a later time, you can select the "Use this as the default and does not ask again" check box.

(2) Click the OK button and if you first enter the workspace that you selected in step (3), the Eclipse Welcome page appears, or you go directly to the eclipse's work station. If the Welcome screen appears, close the Welcome screen and go to Eclipse's main interface, the Eclipse's Workbench window. Eclipse's Workbench consists primarily of menu bars, toolbars, perspective toolbars, Perspectives, Project Explorer views, outline views, editors, and other views. The eclipse is shown in work table 2.2.

Figure 2.2 Eclipse's Workbench
1.2 Eclipse's Menu Introduction
The menu bar is available above the Eclipse Workbench, which contains commands for implementing Eclipse features and is related to the editor, where the menu item in the menu bar is associated with the file that is open in the current editor. For example, if no file is open in the editor, the menu bar shown in 2.2 will be displayed. If a JSP file is open, the menu bar shown in 2.3 is displayed.

Figure 2.3 Eclipse's Menu bar
As you can see from Figure 2.3, when you open a JSP file, the Eclipse menu bar includes 10 menus that contain the corresponding submenus. The common menu in Eclipse 2.4 is shown in.
?

1.3 Introduction to Shortcut keys
In the process of program development, reasonable use of shortcut keys can not only reduce the error rate of code, but also improve the development efficiency. Therefore, it is necessary to master some common shortcut keys. There are many shortcut keys available for this eclipse, which can be viewed in the following steps.
(1) In the Eclipse's System menu bar, select "Window" → "Preferences" menu item, as shown in 2.5.

Figure 2.5 Choosing the Preferences menu

(2) In the Preferences dialog box that opens, after you expand the General node, select the Keys child node for that node, and the dialog box shown in 2.6 appears.

Figure 2.6 Keys dialog box

(3) In the list to the right of Figure 2.6, the commands provided in Eclipse and their corresponding shortcut keys are displayed, where the reader can view the shortcut keys for the command you want, or you can select the specified command to modify the shortcut key for the command.
Note: Although you can modify the shortcut keys for Eclipse commands through the Keys dialog box, I do not recommend that you modify the shortcut keys for Eclipse.

(4) Eclipse common shortcut keys
Eclipse's editing capabilities are powerful, and mastering the editing-related shortcut keys can greatly improve the development efficiency. The common shortcut keys provided by Eclipse are shown in table 2.1.

Table 2.1 Common shortcut keys

Program Debugging methods

Readers in the process of program development will continue to appreciate the importance of program debugging. To verify the health of the Java unit, it used to output state information using the SYSTEM.OUT.PRINTLN () method at the beginning and end of a method invocation, and judged the program execution state based on that information, but this method is more primitive, And it often leads to confusing program code (the system is all exported.) Out.println () method).
This section provides a brief introduction to the use of the Java debugger built into eclipse, which allows you to set breakpoints on a program, implement a program stepping, and view debugging operations such as the values of variables and expressions during debugging. This avoids writing a large number of System.out.println () methods in the program to output debugging information.

The Java debugger that uses eclipse needs to set a program breakpoint, and then use single-step debugging to execute each line of program code separately. The sample code is as follows:

publicclassMyTest {    publicstaticvoid main(String[] args) {        System.out.println("输出1行");        System.out.println("输出2行");        System.out.println("输出3行");    }}

1. Set 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 a breakpoint from the current line, or right-click the current line, and choose the Toggle Breakpoint command from the shortcut menu that pops up to add and remove breakpoints. To "System.out.println" ("Output 1 lines"); Add the breakpoint as an example, as shown in 3.1.

Figure 3.1 Adding a breakpoint to the Java editor

2. Running Java programs in debug mode
To debug the MyTest program in Eclipse, you can right-click in an empty space at the Mytest.java file in Eclipse and select "Debug as" → "1 Java Application" command from the popup shortcut menu. The debugger suspends the current thread at the breakpoint, and the program pauses, as shown in 3.2.

Figure 3.2 Program execution to a breakpoint after pausing

3. Program debugging
After the program executes until the breakpoint is paused, you can perform the appropriate debugging actions, such as run, stop, and so on, through the buttons on the Debug View toolbar. "Debug" View 3.3 is shown.

Figure 3.3 "Debug" view

(1) Single Step Skip
Clicking a button in the Debug View's toolbar or pressing the F6 key will perform a single-step bypass operation, running a separate line of program code, but not inside the calling method, then jumping to the next executable point and suspending the thread.

(2) Stepping into a single step
Clicking a button or pressing the F5 key in the Debug View toolbar will jump into the internal stepping program of the calling method or object and suspend the thread.

Introduction to Eclipse development tools

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.