Eclipse + JDK + Tomcat Development environment configuration

Source: Internet
Author: User
Tags goto

The first step : Download JDK and the Tomcat : JDK download Tomcat download
The latest JDK for 1.6.10,tomcat is 6.0, recommended jdk1.4 above, tomcat4.0 above


Step Two: Install and configure your JDK and Tomcat: Execute the JDK and Tomcat installers, then set the installation to follow the path.
1. After installing the JDK, you need to configure the environment variables and add the following environment variables (assuming your JDK is installed on C:\Program Files\java) in the system variable, high-level environment variable, my computer, properties, and so on:
Java_home=c:\program files\java\jdk1.6.0_10
Classpath=.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; (.; Must not be less because it represents the current path)
Path=%java_home%\bin

You can then write a simple Java program to test whether the JDK has been successfully installed:

Java code

1 public class test{
2 public static void Main (String args[]) {
3 System.out.println ("This was a test program.");
4}
5
6}

Save the above program as a file named

The Test.java file.
Then open a command Prompt window, CD to your Test.java directory, and type the following command
Javac Test.java
Java Test
At this point, if you see the print out of this is a test program. The installation is successful, if you do not print out this sentence, you need to carefully check your configuration situation.

2. After installing Tomcat, add the following environment variable (assuming your Tomcat is installed on the C:\tomcat) in the system variable, advanced environment variable, properties, My Computer
Catalina_home:c:\program Files\apache Software Foundation\tomcat 6.0

Catalina_base:c:\program Files\apache Software Foundation\tomcat 6.0

Tomcat_home:c:\program Files\apache Software Foundation\tomcat 6.0

Then modify the environment variables in the CLASSPATH, the Tomat installation directory under the Common\lib under the Servlet.jar appended to the CLASSPATH, the modified classpath as follows:
Classpath=.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;%catalina_home%\common\lib\servlet-api.jar;
"Note the latest version of Tomcat may not be in Common this folder. So Servlet-api.jar should be the path for

%catalina_home%\lib\servlet-api.jar; Please make your own changes according to your own circumstances. ! "

You can then start Tomcat, Access http://localhost:8080 in IE, and if you see the Tomcat Welcome page, the installation is successful.
Step three: Build your own JSP app directory
1. To the WebApps directory of the Tomcat installation directory, you can see Root,examples, tomcat-docs such as the directory of Tomcat;
2. Create a new directory under the WebApps directory named MyApp;
3.myapp Create a new directory Web-inf, note that the directory name is case-sensitive;
4.web-inf Create a new file, Web. XML with the following content:

<?xml version= "1.0" encoding= "iso-8859-1"?> <! DOCTYPE Web-app Public "-//sun Microsystems, INC.//DTD Web Application 2.3//en" "Http://java.sun.com/dtd/web-app_2_3. DTD ">
<web-app>
<display-name>my Web application</display-name>
<description>
A Application for test.
</description>
</web-app>

5. Create a new test JSP page under MyApp with the file name index.jsp and the file content as follows:

Create a new test JSP page under MyApp with the file name index.jsp and the file contents as follows:

HTML code

<body>
<center>
Now time is: <%=new java.util.Date ()%>
</center>
</body>

6. Restart Tomcat
7. Open the browser, enter http://localhost:8080/myapp/index.jsp to see the current time, the description is successful.

FAQ Processing:

First, Neither the Java_home nor the JRE_HOME environment variable is defined

Just declare the environment variable at the beginning of the Setclasspath.bat, as mine is:

REM---------------------------------------------------------------------------
REM Set CLASSPATH and Java options
Rem
REM $Id: Setclasspath.bat 505241 2007-02-09 10:22:58z jfclere $
REM---------------------------------------------------------------------------

Set java_home=c:\jdk6.0
Set jre_home=c:\jre1.6.0

REM Make sure prerequisite environment variables is set
If not "%java_home%" = = "goto gotjdkhome
If not "%jre_home%" = = "goto gotjrehome
Echo neither the Java_home nor the JRE_HOME environment variable is defined
Echo at least one of these environment variable are needed to run this program
Goto exit
......

This registers the Java_home,jre_home each time the Startup.bat is run. When the console window is closed, these two variables will also disappear and no longer occupy memory. Run, and the final hint "info: Server startup in xxxxx MS" is done.

Second, input : http://local:8080 , hint: server localhost located in XDB Require user name and password resolution:

Cause: Port 8080 is occupied by other services

In general, after installing Oracle, there are port conflicts on the tomcat, and there are two ways to resolve

1. Change the Tomcat port

And then enter: http://localhost:8088 Browse

Erichu
Source: http://www.cnblogs.com/huyong/
Email:[email protected]
QQ Exchange: 406590790
Frame Official website: http://www.rdiframework.net/
Frame Website Blog: http://blog.rdiframework.net/
Frame Other Blogs: http://blog.csdn.net/chinahuyong
Http://www.cnblogs.com/huyong
Rdiframework.net, based on the. NET Rapid Information system development, integration framework, to users and developers the best. NET Framework deployment scenarios.
About system Architects, information systems project managers, DBAs. Focused on Microsoft platform Project architecture, management and enterprise solutions, multi-year project development and management experience, has organized and developed several large projects, in the object-oriented, service-oriented and database areas have a certain degree of accomplishment. is mainly engaged in based on the rdiframework.net framework of technology development, consulting work, mainly services in finance, medical and health, railways, telecommunications, logistics, Internet of things, manufacturing, retail and other industries.
If you have any questions or suggestions, please enlighten me!
This article is copyright to the author and Cnblogs blog, welcome to reprint, but without the author's consent must retain this paragraph statement, and in the article page obvious location to the original connection, if there is a problem, you can contact me by email or QQ, thank you very much.

Eclipse + JDK + Tomcat Development environment configuration

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.