Basic eclipse knowledge

Source: Internet
Author: User

Speaking of Java IDE, Lang's interface is nothing more than eclipse. If we are proficient in eclipse, it will get twice the result with half the effort for us to write Java programs, greatly improving our work efficiency. Therefore, in this blog, I am only a beginner in Java, so that they can learn how to use eclipse as soon as possible.

1. Common shortcut keys

This is the first step to use the tool. The Skillful Use of the shortcut keys will be of great help to programming. Therefore, we recommend that you master the shortcut keys listed here.

CTRL + left mouse button (class, method, attribute variable term): locate and track the position of a variable declaration or definition

CTRL + S: Save the current file

CTRL + X: Cut

CTRL + C: Copy

CTRL + V: Paste

CTRL + D: Delete the current row

CTRL + F: Search/Replace (current editing window)

CTRL + H: Global Search

CTRL +/: comment out the current line or multiple lines of code

CTRL + Shift + C: comment out the current line or multiple lines of code

CTRL + Shift + F: format the current Code

CTRL + Shift + O: The Missing import statement is added, and the redundant Import Statement is deleted (first place the cursor to the Class Name of the package to be imported)

CTRL + Shift + S: Save all files

CTRL + Shift + X: converts all selected text to uppercase

CTRL + Shift + Y: converts all selected text to lowercase

Alt +/: code prompt

Alt + Shift + R: Rename (including file name, class name, method name, variable name, etc., very easy to use)

Alt + Shift + J: generate comments for classes or methods

Alt + Shift + S: Open the source window (generate get and set methods to implement and override methods or classes, which are frequently used)

Alt + Shift + D, J: if the main method entry exists, the code is executed in debug mode.

Alt + Shift + X, J: if the main method entry exists, the code is run.



2. Recommended plug-ins

Eclipse is a pure version by default, so it has simple functions. The most powerful open-source IDE is a variety of plug-ins. Using plug-ins can help us reduce the workload of writing a lot of code, it also helps us reduce the difficulty of writing code, so we know how to install necessary plug-ins, and are also skilled in using IDE.

① Hibernate tools

Hibernate tools is a brand new and complete tool set for hibernate3. It contains the Eclipse plug-in and ant compilation process and is the core component of JBoss tools. Using this plug-in can greatly reduce the workload of using hibernate, and support Automatic Generation of all hibernate XML files, JavaBean, HTML form files, and so on.

Installation address:

② Spring ide

Spring IDE is an Eclipse plug-in recommended on the official spring website. It provides prompts for bean definition files during spring development, verification, and visual viewing of dependencies between beans, it provides powerful support for Spring framework-based project development.

Installation address:

③ Subclipse

Subclipse is an eclipse-based SVN plug-in that supports all versions of eclipse and is a required plug-in developed by the team.

Installation address:

④ Findbugs

Findbugs is an Eclipse plug-in tool that can analyze source code statically and may contain bugs. It checks the class or jar file and compares the bytecode with a set of defect patterns to find possible problems. With this tool, you can analyze the software without actually running the program. It can help improve the quality of code.

Installation address:

⑤ Sysdeo Tomcat launcher plugin

Sysdeo Tomcat launcher plugin is the Eclipse plug-in of Tomcat, which helps us to automatically deploy the Tomcat server. This plug-in is not required and can be left empty.

: Http://


Plugin installation method

There are three ways to install the plug-in:

First: Know the online installation address. Eclipse → help → install new software... → enter the installation address in the address bar (work with) → select the plug-in to be installed → next → agree to the installation protocol → finish → wait until the installation is complete → restart eclipse as required

Second, manually download the plug-in from the official website and integrate it with eclipse. The general idea of this method is to close eclipse first, decompress the downloaded plug-in, and copy it to the plugins folder and features folder under the eclipse installation directory, if necessary, create a link file and re-open eclipse.

Third: Online Search and installation. Eclipse → help → eclipse marketplace... → enter the plug-in you want to find in the search bar → click the Install button → wait until installation is complete → restart eclipse as required

Here I recommend the first method. If you do not know the installation address, use the third method. If the second method is incorrect, the problem may occur, which is highly risky. Therefore, it is not recommended.



3. Tomcat

① Configuration

Window → preferences → server → runtime environment → add → Apache → select tomcat version → next → change display name (name) → browse... browse and select the pre-decompressed Tomcat folder → select JRE → finish → OK → open the servers form → right-click and select new → server → select tomcat version → select the configured Tomcat → next → select the project → finish

② Usage experiences

When we modify a code and start Tomcat to find that the page does not change, we need to turn off Tomcat first, right-click the Tomcat server icon in the servers window, and select clean... to clear the compiled source code, and then start Tomcat to re-compile the source code.

If multiple servers are deployed or Tomcat encounters an exception, right-click the Tomcat server icon in the servers window, select properties, and check whether the location on the right of the general options is correct. If not, click Switch location.

Although one Tomcat can start multiple projects at the same time, it will be slow to start multiple projects. Therefore, if it is not required by the project, we recommend that you deploy tomcat to start only one project, remove temporarily useless items.

If Tomcat fails to be started because the web project has been started for a long time, you can extend the Tomcat startup timeout time (45 seconds by default) and double-click the Tomcat server in the servers window to open the Tomcat Properties window, click the timeouts option in the upper-right corner to modify the START (in seconds) time.

By default, eclipse calls the Tomcat interface to simulate Tomcat startup, instead of starting tomcat, So you often encounter a strange thing: After Tomcat is started, although it can normally go to the web project homepage, the Tomcat kitten homepage (http: // localhost: 8080/) cannot be used, and the files generated after the WEB Project is deployed and compiled are not in the work directory under the Tomcat file directory. Solution: if a project has been deployed under the Tomcat server, remove it all first, that is, right-click the Tomcat server icon in the servers window, and select add and remove ..., click Remove all and click Finish. Then clean up, double-click the Tomcat server icon to open the Properties window, select the server locations option on the left, and select the second single-choice button (use tomcat installation) below ), change "wtpwebapps" (default) in the deploy path text box to webapps, that is, the name of the folder where the project is released in Tomcat. You 'd better redeploy the project to Tomcat and start Tomcat, you can see the familiar kitten page, and the familiar compiled page file can also be seen in the work folder under the Tomcat file directory.

If an error occurs when javax. servlet. http. * is introduced in the Code, it indicates that the jar package of Tomcat is missing. Just import it. Method: Right-click the project in resource manager on the left and select configure build path... under build path ..., click Add library... select Server Runtime, click Next, and select Tomcat and finish.



4. Common eclipse configurations

● Font size

Window → preferences → General → appearance → colors and fonts → right window → basic options → double-click Text font

● Modify the open file editing Browser

Window → preferences → General → editors → File Associations → select the file type to be modified → select Edit browser below

● Show/hide code row numbers

Window → preferences → General → editors → check show line numbers

● Add a custom jar package Libraries

Window → preferences → Java → build path → user libraries → click New... on the right → enter the name → click Add jars... → browse and select the corresponding JAR File

● Configure servers such as Tomcat

Window → preferences → server → runtime environment → add... → select the desired server (take Tomcat as an example, see tomcat configuration above)

● Modify the line feed determination of the formatting code

Window → preferences → Java → code style → formatter → click New on the right... → enter the name → click OK → select the line wrapping tab in the pop-up window → modify the value of the maixmum line width text box (80 by default)

● Add XML syntax rule files such as DTD and XSD to enable automatic code prompts.

Window → preferences → XML catalog → click Add on the right... → public ID for key type → location browse select physical location of the downloaded DTD file → enter the key in the XML document header <! URLs after doctype sqlmapconfig public → OK

● Modify the encoding format

Right-click the project/package/class you want to modify → select Properties → select the encoding format you need under text file encoding on the right of the resource Option

● The same name (including the class name, method name, and variable name) is identified by different background colors.


Or press the shortcut key: Alt + Shift + O


There are a lot of configurations in window → preferences, which won't be fully described here, so only list the most commonly used ones. You may have time to read them here and try them more.



5. SVN

● Upload a project to the svn Server

Right-click the project to be uploaded → team → share project... → SVN → create a new resource library location/use an existing resource library → next → (enter the URL address) → next → use the project name as the folder name → next → finish → (enter the user name/password)

Note: When you use the project name as the folder name, make sure that the svn server has created a folder with the same project name. Otherwise, the import will fail. If the folder name created by the svn end does not match the project name, select "Use the specified Module name" in this step to ensure that the svn server end and project name are consistent.

● Download the project from the svn Server

In the blank space of resource manager, right-click → import... → select the svn folder → check out the project from SVN → create a new resource source library location/use an existing resource library → next → (enter the URL address) → next → check out as a new project, use the New Project Wizard to configure → finish → Yes → configure the new project (for example, enter the project name) → OK

Note: This "input URL address" is different from the upload project above. You need to enter the specific folder of the project, the previous step does not need to include the folder name because the project name is used as the folder name.

● Submit, update, and Restore Files

Select the files, Jar packages, and JavaBean to be submitted, and right-click → team → select the appropriate operation. (This is basically for everyone on earth, so I won't talk much about it)



To learn martial arts, you must first get started with the basic tactics of practice. Only by laying a good foundation can you quickly gain insight into the "Upper-layer martial arts ", so I hope that the "Basic Idea" written by the author will help cainiao become the martial arts master of Wei Zhen!

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: 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.