Eclipse using the Novice tutorial

Source: Internet
Author: User
Tags jboss

Speaking of Java IDE, catchy is just eclipse, if you can skilled eclipse, for us to write Java program will play a multiplier effect, greatly improve our efficiency. So this blog post, the author is only for beginners of the new Java, so that they can quickly master the use of Eclipse.

1. Frequent use of shortcut keys

This is the first step to use the tool, skilled use of shortcut keys for our code will play a considerable help, so here the author listed the shortcut key suggestions must all master.

Ctrl + left mouse button (class, method, attribute variable noun): Position tracking the location of a variable declaration or definition

Ctrl + S: Save current file

Ctrl + X: Cut

Ctrl + C: Copy

Ctrl + V: Paste

Ctrl + D: delete When moving forward

Ctrl + F: Find/replace (current edit form)

Ctrl + H: Global Search

Ctrl +/: Gaze at the current line or multiple lines of code

Ctrl + Shift + C: Gaze at the current line or multiple lines of code

Ctrl + Shift + F: Formatting the current code

Ctrl + Shift + O: The missing import statement is added, and the extra import statement is deleted (first position the cursor on the class name of the package to be imported)

Ctrl + Shift + S: Save All Files

Ctrl + Shift + X: Turns all currently selected text to uppercase

Ctrl + Shift + Y: Turns all currently selected text to lowercase

ALT +/: Code Intelligence Tips

Alt + Shift + R: rename (contains file name, class name, method name, variable name, etc., very useful)

Alt + Shift + J: Create a class or method gaze

Alt + Shift + S: Open source form (Generate get, set method, implement, overwrite interface or class method, not used frequently)

Alt + Shift + D, J: If there is a Main method entry, run the code in debug mode

Alt + Shift + X, J: If there is a Main method entry, run the code as run

2. Plugin Recommendation

Eclipse by default is a pure version, so the function is simple, and the most powerful open source IDE is a variety of plug-ins, through the use of plug-ins can help us reduce the amount of code to write the workload, but also help us reduce the difficulty of writing code, so know how to install the necessary plug-ins, but also skilled use of the IDE authentication

①hibernate Tools

Hibernate Tools is a new and complete set of tools for Hibernate3, which includes the Eclipse plug-in and the ant compilation process, and is the core component of JBoss tools. Using this plugin can greatly reduce the amount of work we use Hibernate and support ourselves in generating all of Hibernate's XML files, JavaBean, HTML form files, etc.

Installation Address: http://download.jboss.org/jbosstools/updates/development/indigo/

②spring IDE

The Spring IDE is the recommended Eclipse plug-in for spring's official site, providing hints, validation, and visual viewing of dependencies between bean definitions files when developing spring. Provides strong support for project development based on spring framework.

Installation Address: http://dist.springsource.com/release/TOOLS/update/e3.6/

③subclipse

Subclipse is an eclipse-based SVN plugin that supports all version numbers of Eclipse, and the team develops the necessary plugins.

Installation Address: http://subclipse.tigris.org/update_1.8.x

④findbugs

FindBugs is an Eclipse plug-in tool that can statically analyze source code for possible bugs. It examines the class or JAR file and contrasts the bytecode with a set of defect patterns to identify possible problems. With this tool, the software can be analyzed without actually executing the program. It can help improve the quality of your code.

Installation Address: http://findbugs.cs.umd.edu/eclipse/

⑤sysdeo Tomcat Launcher Plugin

Sysdeo Tomcat Launcher plugin is the Eclipse plugin for Tomcat, helping us to proactively deploy tomcatserver. The plugin is not a necessary plugin and can not be installed.

: Http://www.eclipsetotale.com/tomcatPlugin/tomcatPluginV33.zip

Plug-in Installation method

There are about three ways to install plugins:

The first: Know the address of the online installation. Eclipse→help→install New Software ... → Enter the installation address in the Address bar (work with) → Check the plugin to install →next→ allow installation protocol →finish→ wait for installation complete → Restart eclipse as required

Another: Manually download the plugin from the official website and integrate it manually with Eclipse. The general idea is to close eclipse, then unzip the downloaded plug-in and copy it to the plugins directory and the features directory under the Eclipse directory, assuming, if necessary, creating a link file and then opening eclipse again.

The third type: Online search installation. Eclipse→help→eclipse Marketplace ... → Enter the plugin to find in the search field → Click installbutton→ to wait for the installation to complete → restart eclipse as required

Here the author recommended the first, assuming do not know the installation address, then use the third, another method sometimes operation error will occur, the risk is larger, so it is not recommended.

3. Tomcat

① Configuration

Window→preferences→server→runtime environment→add→apache→ Select the Tomcat version number →next→ change the display name (name) →browse ... Browse to select the pre-extracted tomcat directory → select jre→finish→ok→ open servers window → Right click to select new→server→ Select tomcat version number → Select the tomcat→next→ selection item you just configured →finish

② Usage Experience

When we change some code, start Tomcat Discovery page does not change, to first turn off Tomcat, right click on the Servers form tomcatserver icon, select Clean ... To clean up the compiled source code, and then start Tomcat to compile the source code again.

And assuming that multiple, or tomcat exceptions are deployed, right-click the Tomcatserver icon in the Servers form, select Properties, check the right location of the general option is correct, and if not, click Switch location.

Although a Tomcat supports launching multiple projects at the same time, the project will be very slow when it is started, so it is recommended that Tomcat deploy only one project to remove the temporary useless items if it is not required for project projects.

When the Web project boot time is too long to cause Tomcat to fail, you can extend the Tomcat startup timeout (default 45 seconds), double-click the Servers form Tomcatserver open the Tomcat properties form, and click the Timeouts option in the upper right. Change the time of start (in seconds).

Eclipse by default is to invoke the Tomcat interface to impersonate the boot tomcat, rather than actually start Tomcat, so you will often encounter a strange thing: after booting Tomcat, although it can normally enter the Web project home page, but not the Tomcat Kitten homepage (that is, http:// localhost:8080/), and the files generated by the Web project deployment are not under the work folder under the Tomcat Files folder. Workaround: Assuming that the project has been deployed under Tomcatserver, first remove all of it, that is, right-click the Tomcatserver icon in the Servers form, select Add and Remove ..., click Remove Allbutton, Click Finishbutton. After cleaning, double-click the Tomcatserver icon to open the Properties form, select the middle Server locations option on the left side, select the Second radio button below (use Tomcat installation), and deploy The "Wtpwebapps" (default) in the Path text box is changed to WebApps, which is the name of the directory where the project is advertised in Tomcat, it is best to deploy the project again to Tomcat, and after Tomcat is started, you will be able to see the familiar kitten page. Familiar compiled page files are also visible at the same time under the work directory in the Tomcat file directory.

Assuming that the code appears to introduce javax.servlet.http.* error, it means that the jar package is missing Tomcat, which can be introduced. Method: Right-click on the project in the left side Explorer, select Configure build path under Build path ..., right side click Add Library...button, select Server Runtime, click Next to select Tomcat, Finish.

4. Eclipse Common Configuration

Font size

Window→preferences→general→appearance→colors and fonts→ right side form →basic options → Double-click Text Font

Change the editing browser to open a file

Window→preferences→general→editors→file associations→ Select the file type you want to change → select Edit browser below

Show/Hide Code line numbers

window→preferences→general→editors→ Check Show line numbers

Join? Define your own Jar package libraries

Window→preferences→java→build Path→user libraries→ right side click on New ... → Enter name → Click Add JARs ... → Browse to select the corresponding JAR file

Configuring server such as Tomcat

Window→preferences→server→runtime Environment→add ... → Select the required server (for Tomcat as an example, see Tomcat configuration above)

Change the line decision of formatting code

Window→preferences→java→code style→formatter→ right side click on New ... → Enter name → Click ok→ in the popup form select line wrapping tab → Change the value of the Maixmum line width text box (default 80)

Add XML syntax rules file for DTD, XSD, etc.

Window→preferences→xml→xml catalog→ right side click Add ... →key Type Select public id→location Browse to select the physical location of the DTD file you downloaded →key fill in the XML document header <! DOCTYPE the URL addresses that follow Sqlmapconfig public →ok

Change the encoding format

Right click on the item/package/class you want to change → select properties→ in the Resource option on the right side of the text file encoding select the encoding format you need

The same name (containing the class name, method name, variable name, and so on) is identified with a different background color

See:

or press the shortcut key: Alt + Shift + O

There are many configurations under the window→preferences, it is not possible to introduce a very full, so just list the most often used, we have time may be more into the here to see, and then more points more try on the clear.

5. SVN

Uploading items to Svnserver

Right-click the item you want to upload →team→share project ... →svn→ Create a new repository location/use an existing repository →next→ (enter a URL address) →next→ use the project name as the directory name →next→finish→ (input username/password)

Note: When using the project name as the directory name, ensure that the Svnserver side has created the same directory as the project name, or the import fails. Assuming that the directory name created by the SVN side does not match the project name, select Use specified module name in this step to ensure that the svnserver side is consistent with the project name.

Download items from Svnserver

Right-click →import in the Resource manager blank ... → Select svn directory → check out project from SVN → create new repository location/Use existing repository →next→ (enter URL address) →next→ as new project check out and use New Project Wizard to configure →finish→yes→ configure new project (such as enter project name) →ok

Note: This "input url" is different from the above upload item, this URL address needs to enter the directory of the project details, and the previous because of the "use project name as directory name" step, so there is no need to bring the directory name.

Submit, update, and restore files

Select the files you need to submit, jar packages, JavaBean, and so on, and then right-click →team→ to select the appropriate action. (this basic earth person will look at the city, so not much to say)

The so-called Learning Kung Fu first to be a formula to practice the basic moves, only have a good foundation, the ability to penetrate the high-speed "upper martial arts", so I hope that the author of the "Basic Heart" can help you rookie soon become the master of the martial arts of Megatron!

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.