Http://www.iteye.com/topic/982182
I have been using eclipse for years. I believe that java programmers do not know about it. Recently, I gave guidance to new students in the team and explained how to build the Eclipse development environment, one is to help them get familiar with the use of IDE as soon as possible, and the other is to ensure the consistency of the team's Development Environment (by the way, this is particularly important in the agile development team and facilitates knowledge dissemination, improve the team's quick response capability ).
During the training, I thought of my first java-related situation, and I was quite touched. The saying goes, "you must first sharpen your tools for good.
This article describes how to build an eclipse environment in windows, including jdk installation and configuration, tomcat installation and configuration, eclipse installation and configuration, and installation of common eclipse plug-ins.
I. Jdk installation and configuration
Jdk7 was just released in July. Currently, the latest version of eclipse does not support jdk7 compilation, so we only download jdk6.
: Http://download.java.net/jdk6/
Select the appropriate installation file for the platform, Windows 32 is currently the latest version: jdk-6u25-ea-bin-b03-windows-i586-27_feb_2011.exe
By default, environment variables must be configured after installation.
For example, my installation directory is C: \ Program Files \ Java \ jdk1.6.
The environment variable configuration is as follows:
Under the XP system, right-click "my computer", select "properties", select "advanced", and click "environment variables"
In "system variable (S )"
Create: JAVA_HOME: C: \ Program Files \ Java \ jdk1.6
New: CLASS_PATH:.; % JAVA_HOME % \ lib
Edit: PATH: Add % JAVA_HOME % \ bin at the beginning;
After creating the environment variable, open cmd and enter "java-version" to verify whether the installation is successful.
Java code
- C: \ Windows \ System32> java-version
- Java version "1.6.0 _ 13"
- Java (TM) SE Runtime Environment (build 1.6.0 _ 13-b03)
- Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode, sharing)
C: \ Windows \ System32> java-versionjava version "1.6.0 _ 13" Java (TM) SE Runtime Environment (build 1.6.0 _ 13-b03) Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode, sharing)
II. Tomcat installation and configuration
Tomcat Official Website: http://tomcat.apache.org/
The latest version is 7.0,
Windows 32 current version: http://labs.renren.com/apache-mirror/tomcat/tomcat-7/v7.0.11/bin/apache-tomcat-7.0.11-windows-x86.zip
This is an decompressed version. After downloading and decompressing it, tomcat needs jdk to run. If jdk environment variables are configured, tomcat will automatically read jdk information from the environment variables, no special configuration is required.
For example, the directory We decompress tomcat is: F: \ apache-tomcat-7.0.11-windows-x86 \ apache-tomcat-7.0.11 (hereinafter referred to as % TOMCAT_HOME %)
Go to % TOMCAT_HOME %/bin and double-click "startup. bat" to start tomcat. If tomcat starts normally, visit "http: // localhost: 8080/" to open the tomcat Management page.
Double-click shutdown. bat to close tomcat.
Manage account Configuration:
Go to % atat_home %/conf, edit tomcat-users.xml ",
Because it is a development environment, we configure a Super User admin to manage tomcat. The edited content is as follows:
Java code
- <? Xml version = '1. 0' encoding = 'utf-8'?>
- <Tomcat-users>
- <Role rolename = "manager-gui"/>
- <Role rolename = "admin-gui"/>
- <User username = "admin" password = "admin" roles = "manager-gui, admin-gui"/>
- </Tomcat-users>
<? XML version = '1. 0' encoding = 'utf-8'?> <Tomcat-users> <role rolename = "Manager-Gui"/> <role rolename = "Admin-Gui"/> <User Username = "admin" Password = "admin" Roles = "Manager-Gui, admin-Gui "/> </tomcat-users>
After restarting tomcat, you can use the admin account to manage tomcat. Here we only describe how to configure the account. For details about how to use the interface to manage tomcat, refer to the Tomcat help documentation, the main reason is that this function is rarely used in the development environment, and I recommend manual configuration.
3. Eclipse installation and configuration
Eclipse official website address: http://www.eclipse.org/
Let's download the J2EE version: Eclipse IDE for Java EE developers
The latest version is Helios Service Release 2.
Windows32 version: http://www.eclipse.org/downloads/download.php? File =/technology/EPP/downloads/release/Helios/Sr2/eclipse-jee-helios-SR2-win32.zip
This version is the decompressed version.
For example, the decompressed eclipse path is F: \ eclipse-jee-helios-SR2-win32 \ eclipse (hereinafter referred to as % eclipse_home %)
If we configure JDK environment variables, double-click eclipse.exe after entering eclipse_home‑environment, you can start eclipse, and a prompt will be prompted to select a workspace at startup.
We recommend that you create more workspaces. You can create different projects in different workspaces according to your actual needs, so that more and more projects in the workspace will affect the startup speed of eclipse (of course, we recommend that you Close a project that is not used recently -- Right-click the Project name and select "Close project". If you need to enable the Project, right-click the closed Project name and select "Open Project .).
You can choose to Switch to the workspace at startup or Switch to "File" -- "Switch Workapsce" after startup.
For more information about how eclipse manages workspace, see http://hanqunfeng.iteye.com/blog/868197 ".
After starting eclipse for the first time, we need to do some basic configuration. Usually we need to do the following Configuration:
1) Configure jdk
By default, eclipse automatically associates with the jdk configured in the environment variable. If multiple jdk versions are installed, You can manually configure them as follows:
"Window" -- "Preferences" -- "Java" -- "Installed JREs" -- "Add" -- "Standard VM" -- select the jdk installation directory.
2) Configure tomcat
"Window" -- "Preferences" -- "Server" -- "Runtime Environments" -- "Add" -- "Apache" -- "Apache Tomcat v7.0" -- select the tomcat7 directory, in JRE, select 1) to configure the jdk.
After the configuration is complete, you can verify it in the "Servers" view. The default "Servers" view is enabled at the bottom of the "Java EE" preset view. If it is not enabled, you can use "Window" -- "Show View" -- "Server" -- select Servers to open the "Servers" View.
In the "Servers" view, right-click -- "New" -- "Server" -- select "Tomcat v7.0 Server". If "Apache Tomcat v7.0" is displayed in "Server runtime environment ", the configuration is successful.
3) Speed up startup
Some plug-ins are loaded by default during eclipse startup, and loading these plug-ins will increase the startup time of eclipse. In fact, some plug-ins are useless for us, so you can disable them as follows:
"Window" -- "Preferences" -- "General" -- "Startup and Shutdown" -- remove the plug-in you don't want.
For example, after installing the plug-in, follow the instructions in this article:
4) Disable Verification
By default, eclipse verifies projects in the workspace, including jsp content and xml content. The verification process consumes a lot of memory. Therefore, we recommend that you disable the verification function. The method for disabling is as follows:
"Window" -- "Preferences" -- "Validation" -- "Disable All ".
5) set the "new" menu item
By default, the new content in eclipse does not meet the requirements. A lot of content needs to be found in other, but we can customize the content in the new menu item as follows:
Right-click the toolbar -- "mimize Prespective..." -- "Shortcuts" -- select the new item you want.
6) default file editor
Eclipse automatically selects the file editor by default. You can also right-click the file and choose editor from "Open With" when opening the file, however, sometimes we may want to make the file use a specific editor. You can configure it as follows:
"Window" -- "Preferences" -- "General" -- "Editors" -- "File Associations", select a specific File name suffix type at the top, select the editor below, and Add by adding, use Default to set the Default editor.
7) annotation style Definition
I believe everyone knows the importance of annotations. In the team, the unified annotation style is more important. You can set the annotation style as follows:
"Window" -- "Preferences" -- "Java" -- "Code Style" -- "Code Templates" -- set it as needed
For example, in Comments
Types:
Java code
- /**
- * Title: project_name
- * Description: XXXX
- * Copyright: Copyright (c) 2011
- * Company: www.xxx.com
- * Makedate: $ {date }$ {time}
- * @ Author $ {user}
- * @ Version % I %, % G %
- * @ Since 1.0
- *
- */
/*** Title: project_name * Description: XXXX * Copyright: Copyright (c) 2011 * Company: www.xxx.com * Makedate: $ {date} $ {time} * @ author $ {user} * @ version % I %, % G % * @ since 1.0 **/
Methods:
Java code
- /**
- * Description: <describes the function implementation functions>. <br>
- * <P>
- * $ {Tags}
- */
/*** Description: <describes the function implementation functions>. <br> * <p> * $ {tags }*/
You can use "Alt + Shift + j" to automatically add comments.
4. Install common eclipse plug-ins
The reason why eclipse is so popular is that it has many plug-ins for support. Here we only introduce several commonly used plug-ins.
1) svn plugin
Some may prefer the "Turtle", but we recommend installing the svn eclipse plug-in.
Official Address: http://subclipse.tigris.org
The latest version is 1.6.17.
Eclipse update site URL: http://subclipse.tigris.org/update_1.6.x
Zipped downloads:
Http://subclipse.tigris.org/servlets/ProjectDocumentList? FolderID = 2240
The plugin installation method is as follows:
"Help" -- "Install new software" -- "add"
Name: svn_subclipse
Location: http://subclipse.tigris.org/update_1.6.x
Click "OK", as shown in:
Select "Subclipse" here, as shown in next.
Click "next", accept, and then click finish to start installation. After the installation is complete, you will be prompted to restart eclipse.
After restarting eclipse, select "SVN repository" in "Window" -- "Show View" -- "Other" -- "SVN" to open the "SVN repository" View.
In the view, right-click -- "new" -- "resource library location" -- enter address -- Finish.
2) propedit plug-in
Official Address:Http://propedit.sourceforge.jp/index_en.html
During development, the problem of multi-language support is often used. The common solution is to put the texts of various languages into the properties file, but the Chinese characters need to be converted into ascii, although some tools help us with transcoding, it is not as convenient to directly write Chinese Characters in propeities. then install the plug-in, which basically supports conversion of various languages. The method is as follows:
"Help" -- "Install new software" -- "add"
Name: propedit
Location: http://propedit.sourceforge.jp/eclipse/updates/
After you click "OK", eclipse will automatically search for it. The time varies depending on the network conditions. Generally, 2 ~ The following page appears in 3 minutes:
Select "PropertiesEditor" here. After next, you need to wait for a while, about 5 ~ When the following page is displayed in 10 minutes,
Click next and you will see the following interface:
Select "accept" and click "Finish". eclipse will start to install the plug-in. The installation process will take about 10 minutes. Please wait. After the installation is complete, you will be prompted to restart eclipse.
After restarting, all. properties file icons are converted to an uppercase P style. Right-click the file and select "Open With". The default editor is changed to "PropertiesEditor, if you use another editor to view the information, you will find that the Chinese text is converted into an accii code.
If you think the url update method is too long to download the plug-in, you can also download the zip package for local installation.
Zip package:Http://zh.sourceforge.jp/projects/propedit/downloads/40156/jp.gr.java_conf.ussiy.app.propedit_5.3.3.zip/
3) decompile the plug-in
Jad is a java decompilation tool, but it is a command line execution tool. Eclipse has a plug-in called jadclipse. After installation, press ctrl + the left mouse button on the java File class name (including the class in the jar package) to open the source file directly.
To install jadclipse, download a jad.exe file first. Unfortunately, the official address of jad is not found. I provided a file in the attachment that supports the decompilation of jdk1.5 and 1.6. Jad.exe must be copied to the % JAVA_HOME %/bin directory.
The latest version of jadclipse is 3.3.0.
Jadclipse: http://sourceforge.net/projects/jadclipse/add the jar folder to the plguinof the local Sever.
Restart eclipse and choose window> preferences> java> JadClipse,
Set path to decompilerto the full path of jad.exe, Which is % JAVA_HOME %/bin/jad.exe to check the information on the Internet. It is said that you can directly double-click ". class file" to open the source file, but it has never been successful. There are also N more useful plug-ins that provide several: findbugs-http://findbugs.cs.umd.edu/eclipse/Mylyn for Eclipse 3.4 and 3.5-http://download.eclipse.org/tools/mylyn/update/e3.4/python-http://pydev.org/updates/jsdt-http://jsdt.googlecode.com/svn/trunk/org.ayound.js.debug.update/ reference: plugin. Wait and discover it by yourself.
Url update or zip package update may take a long time. You can directly copy the decompressed features and plugins of the zip package to % ECLIPSE_HOME %, and restart eclipse to complete the installation.
OK. After the above configuration, a relatively easy-to-use eclipse development environment is built. You can also perform other configurations as needed. The old saying goes: "To do good things, you must first sharpen your tools!
Supplement:Thanks for your reply. Many people have recommended the "EasyExplorer" plug-in, which is provided here. For the links mode configuration, you can refer to: http://java.chinaitlab.com/Eclipse/37794.html
Note: As described in the original article, you need to create an eclipse upper-level directory for the plug-in without the eclipse upper-level directory. I think it is not accurate. In fact, no matter whether there is an eclipse upper-level directory, point the path to the upper directory of plugins.
In addition, I found that the plug-in cannot be loaded when multiple plug-ins are configured using the same link file. Therefore, I suggest using a link file as a plug-in.
Supplement:We recommend another decompilation plug-in, Java decompiler, which provides two methods: gui and plugin. Official Website: Workshop. Eclipse shortcut Daquan: http://www.blogjava.net/action/articles/17339.html
Here, the author calls on everyone to share their experiences in using eclipse, or raise their own confusions and questions to actively share and grow together.
Supplement:Freemarker plug-in,: http://sourceforge.net/projects/freemarker-ide/files/freemarker-ide/0.9.14/freemarker-ide-0.9.14.zip/download
Usage: 1. decompress the package and copy the plugins
% ECLIPSE_HOME %Or use the links method (links is recommended); 2. if you see FreeMarker Editor in window --> Preferences, the installation is successful. 3. *. the Default Editor of the ftl file is FreeMarker Editor ,*. you need to set html or other files by yourself. For more information, see"
3. In eclipse installation and configuration6) default file editor ".