Eclipse Getting Started: User Guide

Source: Internet
Author: User
Tags apache tomcat



I Love Tiananmen, Beijing


Sun rises on Tiananmen


Great leader Chairman Mao


Guide us forward


<SPAN class = "myp111"> <font id = "zoom"> <font size = "2"> In November 2001, IBM announced that it had donated tens of millions of dollars worth of development software to open-source eclipse project. What is so popular eclipse and how to use it? The first section of this article gives you a preliminary understanding of Eclipse. In addition, how will eclipse, an IDE that can be developed in any language in the future, achieve this ambitious goal? The plug-in development of eclipse introduced in the second part will be the key. <Br/> eclipse
It is a next-generation IDE development environment that replaces IBM Visual Age for Java (ivj), but its future goal is not only to become an IDE environment dedicated to developing Java programs, according to the eclipse architecture, with the development plug-in, it can be extended to development in any language and even become a tool for image rendering. Currently, eclipse has begun to provide functional plug-ins for C language development. What's even more valuable is that eclipse is an open-source project. Anyone can download the eclipse source code and develop their own function plug-ins. That is to say, as long as someone needs it, there will be development plug-ins built on top of eclipse in languages such as COBOL, Perl, and python. At the same time, you can develop new plug-ins to expand the functions of existing plug-ins, such as adding Tomcat server plug-ins to the existing Java development environment. It can be expanded infinitely and has a uniform appearance, operation and system resource management, which is exactly the potential of Eclipse.
<Br/> although the Eclipse project has not yet been finalized, the existing version has been able to understand the dominant idea and main features of eclipse design. Now, we know that eclipse not only enables programmers to quickly develop the IDE with high expectations in the industry, but more importantly, if they can participate in Eclipse project development or read its open source code, this is undoubtedly a golden opportunity for programmers to improve their programming skills. The eclipse program provides multiple platform versions, such as Windows, Linux, Solaris, HP-UX, And Aix, which are described below only for Windows. The first part of this article first introduces the basic usage of Eclipse. The second part describes how to develop Eclipse plug-ins.
<Br/> <B> 1. eclipse introduction </B> <br/> eclipse is an open-source project. You can go to www.eclipse.org to download the latest version of eclipse for free. Generally, eclipse provides several Download versions: we recommend that you download the release or stable version. The author uses build20020125 (stable version ). Eclipse is written in Java, but the downloaded package does not contain the Java Runtime Environment. You need to install JRE separately, in addition, specify the bin path in JRE in the environment variable of the operating system. The steps for installing eclipse are very simple: you only need to extract the downloaded package directly from the original path. Note that if an updated version is available, you must delete the old version and reinstall it. You cannot directly decompress the package to overwrite the old version. After Uncompressing the file, you can find the corresponding installer to run eclipse.exe. If the downloaded version is release or stable and the JRE environment is correctly installed, there will be no problems in general. After a cool eclipse image is flashed, eclipse will display its default Interface:
<Br/> </font> <center> <font size = "2"> <br/> Figure 1 </font> </center> <br/> <font size = "2"> first glance, the eclipse interface is a bit like jbilder, but it will be found in the actual operation process more like ivj. After all, the dominant use of eclipse development is the original team of ivj Development (refer to www.oti.com ). In addition, it is worth mentioning that the Eclipse project participants, in addition to IBM, also include Borland, rational
Software, RedHat, merant, and a large number of industry leaders, which laid a good foundation for the future of Eclipse. <Br/> The following describes the features of Eclipse, including file storage, development environment, compilation and running, version management, and plug-ins. <Br/> <font color = "# 0000cc"> 1. file Storage </font> <br/> most ivj beginners are very uncomfortable with failing to find the Java source code, because ivj stores all the source code to a reponsitory library file, to obtain the source code in text format, you must use the export function to export the source code from reponsitory. The ivj that uses reponsitory has almost reached the limit in managing source code, which makes many programmers love ivj. Eclipse saves the source code in text mode, but implements almost all of ivj's source code management functions. It also adds some new functions to achieve this, you can't help but wonder at the superb skills of eclipse developers.
<Br/> after eclipse is installed, a workspace folder is located in the next path of the installation path. Every time a new project is generated in eclipse, all files used by the project are stored in folders with the same name in the workspace by default. You can use Windows Resource Manager to directly access or maintain these files. <Br/> there are currently three ways to add existing files to a project: the first is like in ivj, use the "import" function in the "file" menu of IDE to import files to the project. This is also recommended. The second is to drag files from the Windows Resource Manager to the project. The third method is to directly copy the file to the project folder, select a project or folder in the eclipse resource browsing window, and execute the refresh function (
From locate ). It should be noted that the project folder can be placed anywhere on the computer, and the project path can be specified to an existing project folder by creating a project in eclipse, then refresh in eclipse. Note that any project folder can be created or specified only in eclipse, even if you create a folder under the workspace path of the default storage project folder, you cannot change it into a project in the eclipse environment. That is to say, this folder is invisible to eclipse. <Br/> <font color = "# 0000cc"> 2.
Eclipse Development Environment </font> <br/> like ivj, the eclipse development environment is called workbench. It consists of three parts: View (Perspective ), editor and view ). In the following introduction, we hope that readers can know the differences among the Java view, Java package browsing window, resource view, and resource browsing window (in fact, the most important thing is to distinguish between views and windows ), avoid confusion during further reading. Figure 2 shows the Link Structure between them. <br/> </font> <center> <font size = "2"> Src = "/images/blog_csdn_net/arielxp/16130/r_eclipse2.gif"/> <br/> Figure 2 </font> </center> <br/> <br /> <font size = "2"> in Figure 2, it can be seen that workbench contains multiple views, and each view contains different windows. Since each editing window has a lot of commonalities and is displayed in the same area by default, we only mark an editing window in each view, in green. The observed windows are different, which are marked in red. <Br/> The following describes the editing window. The display and editing of all files are included in the editing window. By default, multiple opened files are arranged in the same window in the tagtable mode. You can drag these files into various la S. The method is to drag the tag of a file to the border of the editing window and release it when the light is marked with a change.
<Br/> when a file is added to a project, double-click the file in the resource browsing or Java package browsing window. eclipse will try to open the file: the eclipse embedded editor can open some files by default, such *. java ,*. TXT ,*. class. For other types of files, eclipse will call the corresponding Default Editor of the operating system to open them, such as Word documents and PDF files. At the same time, eclipse can use the specified editor to open the corresponding file like ivj. For example, if you double-click an HTML file in an Eclipse project, you may want to use Notepad instead of the default IE browser. The solution is to open the workbench à preferences dialog box in the menu bar, and then select workbench à file in the dialog box.
Editors, and then add the file type, such as *. html, and then specify the editor for it. <Br/> in the editing window, it is worth noting that when ivj programmers edit Java programs, it is more willing to use the method as an independent Editing Unit (that is, only a single method is displayed in the editing window, rather than the entire source code of the Program). This method is indeed a very reasonable development method, not only is code Display simpler, but it also helps programmers compile classes with better encapsulation. Eclipse provides a switch button on the toolbar, in "show all code" and "show only the selected units" (here the unit refers to a single method, variable, imported package, etc) switch between them (see figure 3 below ). Not recommended
<Br/> programmers who have used ivj can also perform code development in the "show only selected units" status. <Br/> next, we will introduce the observation window, which works with the editing window and provides a variety of related information and browsing methods. Common Observation windows include navigator, packages, console, and task. <Br/> the browser window and Java browser window are the core parts of the observation window. The former is similar to a Windows browser and can browse all files in the project folder. The latter is used to browse information such as Java packages, classes in packages, variables and methods in classes in the project. In the Java browser window, you can right-click open in the menu
Type hierarchy opens the hierarchy window, which is very practical and can clearly view the hierarchy of classes. Class compilation error information can be found in the task window, it can also be a real task window: Add a new task description to it to track the progress of the project. The console is mainly used to display program output information. When debugging a program, there will be a richer observation window to help programmers debug the program, such as the variable value viewing window and breakpoint window. <Br/> the observation window is the core of any IDE development environment. The observation window is the IDE development environment. Eclipse provides a wide range of observation windows. It may take some time to make good use of these windows.
<Br/> the last section describes the view. A view contains one or more editing and Observation windows. The upper part of the shortcut bar on the far left of the development environment shows the currently opened view icon. A view is the most flexible part of eclipse. You can customize the types of observation windows contained in each view, or customize a new view. These functions are included in the "Perspective" menu. Several default views are provided in the Java Development Environment of Eclipse, such as resource perspective, which is also the default view when eclipse is started for the first time) and Java view (Java perspective ), debug View
Perspective), team view, and so on. Each view corresponds to different types of observation windows. You can see the corresponding observation window of the view from perspective à show view in the menu bar. Of course, the observation window of each view is configurable and can be configured in perspective à mimize on the menu bar. Diverse views not only help programmers observe code from different perspectives, but also meet different programming habits. <Br/> <font color = "# 0000cc"> 3. compilation and running </font> <br/> In ivj, the debugging function is very powerful. It supports multiple tracking methods, breakpoint settings, and variable value Viewing Windows. These are also available in eclipse. The following sections describe how to use the configuration project environment and run and Debug Programs with examples.
<Br/> in the Java view, there are two buttons in the toolbar for debugging and running. In addition, there may be multiple ways to run/Debug Programs for different installed plug-ins in eclipse. To determine which method to run the current project, you need to set the launcher à run/debug option in the property options of the project. We usually need to use the "Java applicantion" method. In this mode, if the current position is a Java program that contains the main () method, click the debug/run button to start the debugging/run function immediately. If the current location is on the package or project, eclipse will search for All executable programs contained in the current location, and then the programmer chooses to run that program.
<Br/> in the current releases of eclipse, the plug-in Development Environment (PDE) is installed by default, in addition to the "Java applicantion" Running method, the system may have two other methods: "Run-Time workbench" and "Run-Time workbench with tracing ", these two running methods are used when you develop plug-ins using apsaradb for MongoDB. We will also mention them below. <Br/> <font color = "# 0000cc"> 4.
Version Management </font> <br/> you can divide eclipse version management into personal (or local) and team management. <Br/> eclipse provides a powerful personal version management mechanism, and each saved change can be restored. It can also be accurate to the version recovery of each method. The operation is also very convenient. In any observation window that can see the file to be operated, such as the resource browsing window, select the file, click the right mouse key, and select compare with or replace, if you want to restore the deleted method, you can select Add from local history. Then, the corresponding local history will be displayed, and you can find the corresponding version as required. The powerful personal edition management function provides programmers with more confidence: just compile it, and any accidental errors can be recovered. developed under eclipse, there is a "regret!
<Br/> eclipse provides interfaces for version management tool CVS by default, allowing you to easily connect to the CVS server. Through CVS version management, eclipse provides a good environment for team development. To connect to the CVS server, you must first open the team view (team perspective), right-click the reponsitories observation window, and select new ), in the displayed dialog box, you can enter the information required for the CVS database to be connected, such as the CVS server type. Currently, eclipse supports three methods: pserver, extssh, and Ext. You can also enter the user name and host name, password, reponsitory address, and other information.
<Br/> when using CVS in eclipse, You need to note the changes in terms and functions. Branch in CVS is called stream, the check out, import, commit, and other functions in CVs are canceled. All functions are replaced by "team-& gt; synchronized with stream" in the right-click menu. These functions are completed through the graphic interface. In each operation, there will be a comparison window between the current file and previous versions. The operation is very intuitive and easy to master, so we will not introduce them further here. <Br/> <font color = "# 0000cc"> 5. Use plug-ins </font>
<Br/> using plug-ins can enrich eclipse functions. The following describes how to embed plug-ins into the Tomcat server. This plug-in was not developed by the Eclipse project team, but developed by a company called sysdeo, which is very small and only 27.8 K. Go to http://www.sysdeo.com/eclipse/atatplugin.htmlto download the package for free. In addition, this plug-in only supports versions above tomat4.0. You can get the latest tomcat version at www.apache.org. <Br/> to install the plug-in, simply extract the downloaded ZIP file to "Your eclipse installation path/plugins" and restart eclipse. After startup, select perspective à mimize on the menu bar and select other à tomcat in the displayed dialog box. Now you will find two changes in Eclipse: One Tomcat option in the menu bar and two buttons in the toolbar. The above is a tomcat kitten that you may be very familiar with, for example, three. In addition, select workbench à preferences in the menu bar. After the dialog box is opened, a tomcat option is added. You must specify the root path of your tomcat installation. Check the Java à installed in the preferences dialog box.
Whether the JRE specified by JRE is the same JRE as the JRE that starts tomcat. If not, Tomat may fail to start normally. If the above check is correct, you can use the "kitten" on the toolbar to start Tomcat directly. Note that the startup process is slow. wait patiently until the following information appears: <br/> starting service tomcat-standalone <br/> Apache Tomcat/4.0.1 <br/> starting service tomcat-apache <br/> Apache Tomcat/4.0.1 <br/> <ccid_nobr> </font> <br
/> <Br/> <font size = "2"> then, you can enter http: // localhost: 8080 in an external browser (such as IE) to test whether Tomcat works normally. <Br/> </font> <center> <font size = "2"> <br/> Figure 3 </font> </center> <br/> <font size = "2"> If the startup is normal, you can try to debug servlet or JSP programs in eclipse. Next we will use helloworldexample. Java, the servlet routine that comes with tomcat, to demonstrate how to debug the sevlet program in eclipse.
<Br/> first, create a new Java project in the Java view. For convenience, you can directly specify the project path to the path of the helloworldexmaple program. 4: <br/> </font> <center> <font size = "2"> <br/> figure 4 </font> </center> <br/> <font size = "2"> press "Next", go to Java
In the Settings dialog box, select the libraries tag and use the Add external jars button to specify the servlet. jar package location. The servlet. jar package in Tomcat is used directly. V: <br/> </font> <center> <font size = "2"> <br/> Figure 5 </font> </center> <br/> <font size = "2"> finally, click "finish" to generate the project. Default in the freshman Project
Package can be found in helloworldexample. java. Double-click to open the file and try to add a breakpoint to helloworldexample (double-click the left border of the editing window ). Then, enter http: // localhost: 8080/examples/servlet/helloworldexample in the external browser. Then, let's look at the changes in eclipse. It's a debugging window! Debugging operations in eclipse are similar to those in most ides, such as breakpoint setting, single-step tracking, and variable value viewing. You don't need to go into details here. </Font> </span>

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.