JAVA Web site running environment built

Source: Internet
Author: User
Keywords Java

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Now the open source projects on the market can basically boil down to two broad categories, Java and PHP. But for most webmaster, especially the software technology to understand less webmaster, the choice of PHP open source project will be easier to start, especially in recent years the domestic Chinese open source PHP project has a great development, resulting in discuz, ShopEx, DEDECMS and other applications more extensive and mature open source system. However, the Java Web Open source project itself has the advantages of PHP open source project does not have the advantage of some webmaster use, such as the system's technical architecture, security, database access versatility. On the whole, PHP is more used for small and medium-sized systems, and Java can be used in large systems, we do not discuss the comparison between the two languages, but mainly to teach you how to build a Java Web Open source project's operating environment, especially for some use of Java Web projects to build stations webmaster, Don't know much about Java itself, may not be too clear in the choice of server environment, the next specific to explain how to build a Java Web site operating environment, with Windows operating system environment as an example:

First step: Download and install the JDK (JDK is the basic environment for Java programs to run, It's like. NET Framework, it should be noted that, depending on the type of server operating system selected and the number of digits of the operating system, if the 64-bit server, to select the corresponding 64-bit JDK, otherwise there will be errors, which I encountered in a recent project, the server is Windows Server 2008 32-bit, but the downloaded software is still 32-bit, and the result is that the Java program cannot run at all until the installation is successful.

Everyone open source to the Java official website download JDK Software installation package, in the following figure select the first option on the left "Accept License Agreement (Consent License Agreement)", according to the actual need to select the corresponding development platform of the JDK to download.

  

After the download is complete, run the program to install the JDK, and you can change the JDK and JRE default installation path during the installation process.

The second step: Set the environment variable, to enable the JDK to compile and run Java files, you need to set the system path and CLASSPATH environment variables

Turn on: My Computer-> Properties-> advanced system settings-> environment variables

Click the "New" button in the system variable area to create a new 3 environment variable.

Set Variable name: Path, Variable value: C:\Program files\java\jdk1.7.0_04\bin

Set Variable name: ClassPath, Variable value:.; C:\Program Files\java\jdk1.7.0_04\lib\dt.jar; C:\Program Files\java\jdk1.7.0_04\lib\tools.jar

Set Variable name: java_home, Variable value: C:\Program files\java\jdk1.7.0_04

Step three: Validate JDK configuration information

Open windows to execute CMD command, open a command window, enter: Java or input: java-version, if the correct output of relevant information, the configuration is successful.

  

Fourth step: Download Tomcat and unzip the deployment project

Tomcat version can be divided into 2 types according to the type, one is the installation version, one is the decompression version (that is, green software, can be used directly after decompression). Here we select the decompression version, the following figure, after decompression can be found from the Tomcat directory of the root directory WebApps, we need to do is to deploy the site source code copied to this directory, such as we will deploy the project upload copy to WebApps under:

  

Step Fifth: Start Tomcat, run the Web site

Web Startup method: Locate the Bin folder in the Tomcat directory, and then double-click the Startup.bat file, as shown below

  

After startup completes, to test whether Tomcat is successful, you can access address http://localhost:8080, as shown below

  

Run the site, take upload as an example, open the address http://localhost:8080/upload (this upload is just my own write a test page)

  

So we can start running our Java Web project.

Related tips: Tomcat's port is 8080, we can set the port as needed, such as we want to set to 8088, then we need to modify the tomcat in the Conf directory of Server.xml, the following settings, such as the figure

  

As shown above, we can also set tomcat default encoding, such as your project is UTF-8, if not set up, the project will appear garbled in the process, so we in the above configuration file to add uriencoding= ' UTF-8 ' on it. Also, this modified profile requires that Tomcat be restarted to take effect.

OK, through the above configuration, we have completed the Java Web running environment. The simple summary is that Java Web projects must have and successfully configure two things to run, one is the JDK, the other is the Web server tomcat (there are, of course, other Web servers on the market that are spending Java Web projects).

This article by the copper Door Http://www.ahdctm.net original, reprint please indicate the source! Thank you!

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.