Java Development Environment setup

Source: Internet
Author: User

Java development environment to build detailed http://topic.csdn.net/u/20110829/13/BF4FAA45-3E1A-48A8-BC46-0405B7F862A2.html

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: \ Documents ents and Settings \ user> java-version java version "1.5.0 _ 11" Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0 _ 11-b03) Java HotSpot (TM) client VM (build 1.5.0 _ 11-b03, 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>

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

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

/***** <One-sentence function description> * <function description> ** @ author user * @ version [version number, aug 29,201 1] * @ see [related classes/methods] * @ since [product/module version] */

Methods:

Java code

/*** <One-sentence function description> * <function description> * @ param args [parameter description] ** @ return void [return type description] * @ exception throws [violation type] [violation description] * @ see [Class, Class # method, class # member] */

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" and select "Subclipse" only ",

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.

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.