Usage Guide for Eclipse development tools

Source: Internet
Author: User
Tags add functions connect new features version variable versions apache tomcat
November 2001 IBM announced the donation of 40 million dollars worth of development software to open source Eclipse project. What is so popular about Eclipse, and how do you use it? The first part of this article will give you a rudimentary understanding of eclipse. And how will eclipse, the IDE synthesizer who boasts of future development in any language, achieve its ambitious goal? The second part of the introduction of Eclipse plug-in development will be the key.

Eclipse is the next-generation IDE development environment that replaces IBM Visual age for Java (hereinafter referred to as IVJ), but its future goal is not only to become an IDE environment dedicated to developing Java programs, but, depending on the architecture of Eclipse, by developing Plug-ins, It can be extended to any language development and can even be a tool for drawing pictures. Currently, Eclipse has started to provide functional plug-ins for C language development. What's more, Eclipse is an Open-source project where anyone can download the source code of Eclipse and develop their own plug-ins on that basis. That means that in the future, as long as someone needs it, there will be a development plug-in for languages such as Cobol,perl,python built on eclipse. You can also extend the functionality of existing Plug-ins by developing new plug-ins, such as adding Tomcat server plug-ins to existing Java development environments. Can be extended indefinitely, with a unified look, operation, and system resource management, which is where Eclipse's potential lies.

Although the Eclipse project has not yet been finalized, the eclipse design-led ideas and key features are already available from existing versions. Understanding eclipse now will not only enable programmers to see the industry's highly-anticipated IDE as soon as possible, more importantly, if you can take part in the development of the Eclipse Project or read its open source, this is a once-in-a-lifetime opportunity for programmers to improve their programming skills. The Eclipse program provides versions of multiple platforms, like Windows,linux,solaris,hp-ux and AIX, and the following describes only the Windows version. The first part of this article first introduces the basic usage of eclipse. The second section describes how to do plug-in development for Eclipse.

 Eclipse Introduction

Eclipse is an Open-source project, you can go to www.eclipse.org to download the latest version of Eclipse for free, and General Eclipse offers several downloadable versions: Release,stable build,integration Build and nightly builds, it is recommended to download release or stable version, the author is Build20020125 (stable version). Eclipse itself is written in the Java language, but the downloaded compression pack does not contain a Java runtime environment, requires the user to install the JRE separately, and indicates the path to the bin in the JRE in the operating system's environment variable. The steps to install eclipse are simple: simply unzip the downloaded compressed package directly to the original path. Note that if there is a newer version, first remove the old version reinstall, can not be directly extracted to the original path cover old version. After decompression, you can go to the appropriate installation path to find Eclipse.exe run. If you download a release or stable version, and the JRE environment is installed correctly, there is generally no problem, and Eclipse displays its missing provincial after flashing a cool eclipse Picture:



At first glance, Eclipse's interface is a bit like jbuilder, but it's more like ivj in the actual process, after all, the dominant dosage of developing eclipse is to develop IVJ's original class (refer to Www.oti.com). It is also worth mentioning that the Eclipse Project's participants, in addition to IBM, have a large number of industry borland,rational such as Software,redhat,merant, which also provides a good foundation for Eclipse's future. 


The following are a brief introduction to the various features of Eclipse, including: file storage, development environment, compilation and operation, versioning, and use of plug-ins.

1. File Storage

Most ivj beginners are unable to find the Java source code is very uncomfortable, because ivj all the sources are stored in a reponsitory library file, want to get the text format source code must use the export function from the reponsitory source. Using Reponsitory's ivj to manage the source code almost to the extreme, it is this that many programmers are fond of ivj. While eclipse saves the source code as text, it implements almost all of IVJ's control of source code, and adds new features that can be achieved without marveling at the superb skills of the eclipse developer.

After you install eclipse, there is a workspace folder in the next layer of path in the installation path. Whenever you are reborn as a project in Eclipse, a folder with the same name as the project is generated by default in workspace to hold all the files used by the project. You can use Windows Explorer to access or maintain these files directly.

There are currently three ways to add existing files to a project: the first is to import files into a project using the import feature from the IDE's "file" menu, as in Ivj. This is also the recommended way. The second is to drag files directly into the project from the Windows Explorer. The third is to copy the files directly to the project folder and then select the items or folders in the Eclipse's Resource Browsing window and perform a local refresh (refresh from locate). The point to note is that the project folder can be placed anywhere on your computer, and you can specify the project path to an existing project folder in eclipse using the new project's method, and then refresh in Eclipse. Note, however, that any project folder that is established or specified is currently only implemented in eclipse using the new project method, even if a new folder is created under the workspace path of the default storage project folder, and it cannot be turned into a project in the eclipse environment, that is to say, This folder is not considered for eclipse.

2. Eclipse Development Environment

Like IVJ, the Eclipse development environment is called Workbench, which consists of three parts: A view (Perspective), an editing window (Editor), and an observation window (view). In the following introduction, I want readers to know the Java view, Java Package Browsing window, resource View, Resource Browsing window and other differences (in fact, the most important thing is to distinguish between views and Windows), so as to avoid confusion in further reading. Figure two is a sketch of the relationship structure between them:

 you can see that workbench contains multiple views, and each view contains a different window. Because each edit window has a lot in common and by default they all appear in the same area, so we only have one edit window in each view, in green. The observation window is different, shown here in red.

The editing window is described below. The display and editing of all files are included in the edit window. Multiple files that are opened by default are arranged in the same window as labels (tagtable), and you can drag to arrange them in a variety of layouts. The method is to drag a file's label (tag) to the border of the editing window, and then release when the cursor changes accordingly.

When a file is added to a project, and the file is double-clicked in the resource browsing or Java Package Browsing window, Eclipse attempts to open the file: The editor in Eclipse can open some files by default, such as *.java,*.txt,*.class and so on. For other types of files, Eclipse calls the operating system's corresponding default editor to open, such as Word documents, PDF files, and so on. Also, eclipse can open the appropriate file with the specified editor as ivj. For example, when double-clicking an HTML file in an Eclipse project, you might want to open it in Notepad instead of using the system default IE browser. The way to do this is to open the Workbenchàpreferences dialog box in the menu bar, then select Workbenchàfile Editors in the dialog box, and then add the file type, such as *.html, and then assign the editor to it.

In the editing window, it's also worth noting that accustomed to the IVJ programmer in the editing of Java programs, the more willing to use the method as a stand-alone editing unit (that is, in the editing window to show only a single method, rather than the full source of the program), this approach is indeed a very reasonable way to develop, not only the display of the code more simple , it can also help programmers to compile better packaged classes. Eclipse provides a toggle button on the toolbar that toggles between show all code and show only selected units (where the cells refer to a single method, variable, imported package, and so on) (refer to figure three below). Advice not

Programmers who have used IVJ also try to develop code in the "Show only selected units" state.

The second thing to introduce is the observation window, which works with the editing window and provides a variety of related information and browsing methods. Common observation windows are resource browsing (Navigator), Java Package Browsing window (Packages), console (console), taskbar (Task), and so on.


The Browse window and the Java Browsing window are the core parts of the viewing window. The former is similar to Windows browser and can browse through all the files in the project folder, which is used to browse the Java packages in the project, the classes in the package, the variables and methods in the class, and so on. In the Java Browsing window, you can open the Hierarchical Browsing window (hierarchy) by using the open type hierarchy in the right mouse menu, which is very useful, and it can see the class hierarchy very clearly. The compilation error information in the class can be found in the Task window, and it can also be a veritable task window: Add new task descriptions to it to track the progress of the project. The console is used primarily to display the output information of the program. In debugging the program, there will be a richer observation window to help programmers debug, such as Variable Value view window, breakpoint window and so on.



The observation window is the core of any IDE development environment, and a good view window is to use the IDE development environment. Eclipse provides a wealth of observation windows, and it may take some time to hone the real use of these windows.


The Describes the view at the end. A view includes one or more editing windows and an observation window. The view icon that is currently open is displayed in the upper section of the leftmost shortcut bar in the development environment. Views are the most flexible part of Eclipse, you can customize the types of observation windows that are included in each view, or you can customize a new view. These features are included in the "Perspective" menu. There are several default views available in Eclipse's Java development environment, such as the Resource View (Resource perspective, which is also the default view when you first started eclipse), Java View (Java perspective), Debug View (Debug Perspective), Team view (group perspective), and so on. Each view corresponds to a different kind of observation window. You can see the viewing window for the view from Perspectiveàshow view in the menu bar. Of course, the observation window for each view is configurable and can be configured on the perspectiveàcustomize in the menu bar. A diverse view can not only help programmers observe the code from different angles, but also can satisfy different programming habits. 


3. Compiling and running

Debugging in IVJ is very powerful, with a variety of tracking methods, breakpoint settings, variable values view windows, and so on. These are also available in eclipse. When I introduce the plugin below, we will combine examples to describe in more detail how to use the configuration project environment, how to run and debug the program.

In Java View, the toolbar has two buttons, which are used for debugging and running, respectively. Also, depending on how the plug-in is installed differently than eclipse, there are many ways to run/debug the program, and in order to determine how the current project works in that way, you need to set the LAUNCHERÀRUN/DEBUG option in the project's property options. Usually we need to use the "Java applicantion" approach. In this way, if the current position is a Java program that contains the main () method, the Debug/Run button will immediately start the debugging/running function. If the current location is on a package or project, Eclipse searches for all the executable programs that are contained in the current location, and then the programmer chooses to run that one.



The plug-in development environment (Plug-in Development Environment, PDE, which is itself a plug-in) is installed by default in the current release and stable versions of Eclipse, when the system is in addition to the Java applicantion "There may be two other ways to run it:" Run-time WorkBench "and" Run-time WorkBench with tracing, "which are used when developing plug-ins with PDE, as we mentioned below.

4. Version Management

You can divide Eclipse version management into individuals (or local) and teams.

Eclipse provides a powerful personal versioning mechanism, and each saved change can be restored. And can be accurate to the version of each method recovery. The operation is also very convenient, in any one can see the file to manipulate the observation window, such as the Resource Browsing window, select the file, click the right mouse button, select Compare with or replace with, if you are recovering has been deleted method can choose Add from the Local History, then the corresponding local history will be displayed, according to your needs to find the appropriate version of it. Powerful personal versioning provides programmers with more confidence: just make up, any careless error can be restored, under eclipse development, there is "regret medicine"!



Eclipse defaults to the interface for version management tools CVS, which makes it easy to connect to a CVS server. With CVS version management, Eclipse provides a good environment for team development. To connect to a CVS server you need to open the team view first, and then click the right mouse button in the Reponsitories Observation window and select New (new) to fill in the Open dialog box with the information you need for the CVS library you are connecting to, such as the CVS server type perspective , currently eclipse supports three ways: PServer, extssh and ext, and fill in the user name, hostname, password, reponsitory address, and other information.



Using CVS in Eclipse is a note of changes in terminology and functionality that branch in CVS, called Stream, cancels out CVs in check out, import, and commit functions, all with the right mouse button team-> in the menu Synchronized with the stream to replace. These functions are done through the graphical interface, each operation will have the current file and the previous versions of the comparison window, the operation is very intuitive, easy to grasp, so here is no longer to do further introduction.

5. Use Plug-ins

Use Plug-ins to enrich eclipse's functionality. The following describes how to apply Plug-ins to embed a tomcat server. This plugin was not developed by the Eclipse Project team, but was developed by a company called Sysdeo, very compact, only 27.8K. You can go to http://www.sysdeo.com/eclipse/tomcatPlugin.html for free download. In addition, this plugin only supports Tomat4.0 versions and can get the latest version of Tomcat in www.apache.org.

To install the plug-in, simply unzip the downloaded zip file to the original path under your Eclipse installation path \plugins, and then restart Eclipse. Select Perspectiveàcustomize on the menu bar after startup and Otheràtomcat in the Open dialog box. You'll soon notice that Eclipse has two variations: a Tomcat option in the menu bar, and two more buttons on the toolbar, the Tomcat kitten that you might be familiar with, as shown in Figure three. In addition, in the menu bar select: Workbenchàpreferences, open the dialog box you will find that there is also a tomcat option, where you are asked to specify your Tomcat installation root path. After that, check to see if the JRE specified by the javaàinstalled JRE in the Preferences dialog box is the same JRE as the one that started Tomcat, and if not, may cause Tomat to start normally. If the above check is OK, you can use the "Kitten" on the toolbar to start Tomcat directly. Be aware that the startup process is slow, and be patient until the following information appears:


     
     Starting service Tomcat-standalone Apache tomcat/4.0.1 starting service Tomcat-apache Apache tomcat/4.0.1


You can then enter http://localhost:8080 in an external browser, such as IE, to test whether Tomcat is normal.



If it starts properly, you can further attempt to debug a servlet or JSP program in Eclipse. Here we'll demonstrate how to debug the Sevlet program in eclipse using the Tomcat-with-Helloworldexample.java servlet routine.

To create a new Java project in Java view, you can assign the project path directly to the path to the Helloworldexmaple program, as shown in Figure four:



Then press "Next" to enter the Java Settings dialog box, select the Libraries tab, and use the Add External jars button to specify the location of the Servlet.jar package. The Servlet.jar package in Tomcat is used directly here. 、、


Finally, click Finish to complete the project generation. In the freshman project, default package can find Helloworldexample.java, double-click to open the file, and try to add a breakpoint to Helloworldexample (double-click the left edge of the edit window). Then enter in the external browser Http://localhost:8080/examples/servlet/HelloWorldExample, come back and see what happens to eclipse, it's a debugging window! Debugging in Eclipse is much the same as most Ides, such as setting breakpoints, stepping tracking, variable value viewing, and so on, which is no longer detailed here.

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.