Intellij the tomcat environment of the Idea series (III.)

Source: Internet
Author: User

Intellij The tomcat environment of the Idea series (III.)

I. Preparation of the background

   Intellij Idea in the beginning when a lot of people spit groove, "God, so difficult to use the IDE who use it?" Indeed, IntelliJ is a time-consuming and laborious thing for beginners in setting up certain environments. Many of my friends and colleagues at the time of learning IntelliJ idea, at the beginning are holding a high enthusiasm to learn, in the writing of simple code, will be heartfelt sigh, really better than eclipse, but when they learn the tomcat environment in the building, most of them gave up, But that was a few years ago. Now online on the Tomcat environment of the Building information is also very complete, perhaps someone will ask, the Internet has the corresponding information, why do you want to write, my answer is: in the online request for all these years, want to give something out, or want to tidy up some information, Want to win some of the views of the majority of peers. I hope that when readers see this poor article chapters more spit Groove.

Two. Building the tomcat environment in IntelliJ

At present, my module only J2SE in the last two posts, as shown in

Click the right mouse button in the blank position->new->module, or click File->new->module in the menu bar. As shown

After the above operation will appear the following interface, select "Java Enterprise", and then "Web Application (3.3)" Before the hook, and then "Create web." Before the hook. As shown

Click "Next", the following interface appears, the reader only to modify the "content root" the last "\" after the content, that is, the name of your module (the author's name of the module "CMS"), the other two will be changed along with

Click "Finish" to see the module named "CMS" appears under Project, as shown in

Create two folders under the Web-inf directory named "Classes", "Lib", as

Click File->project Structure in the menu bar, the following screen appears, click on the left "Modules"; Click on "CMS" to switch the tab on the right side to "Paths"; Select the radio button before "User Module compile Output path", as shown in the red box

Clicking on the "..." button in the "Output path" and "Test output path", respectively, will pop up the following interface

Locate the path under the Classes folder you created earlier, and then click "OK", such as "Output path" and the path after "Test output path" to both locate the classes directory

Switch the tab on the right side to "Dependencies", click "+", and then select "JARS or directories", such as the red box labeled

In the pop-up interface, navigate to the previously created "Lib" directory, as shown in

Clicking "OK" will pop up the interface shown and select "Jar Directory", as shown in the red box

Click "OK" and you will find a path that is located in the "Lib" directory, as shown in

Click "Artifacts" on the left, "Names" on the right by default; "Type" select "Web application:exploded"; "Output directory" path defaults; "Build on Make" is checked; Show content of elements "on the front hook, as shown in the red box

Click "OK" to go back to the main editing page and click on the Run->edit configurations of the menu bar, as shown in the red box

Click "+" in the upper-left corner, select "Tomcat Server" in the drop-down list that appears, and then select "Local", as shown in the red box

In the interface that appears, change "Name" to "Tomcat-server" (readers can choose to name according to their hobbies); Switch the tab to "Server", and remove the "after Launche" check; Then click on "Configure.", as shown in the red box

Clicking on the "Configure" button will pop up as shown in the interface

Clicking on the "..." button after "Tomcat home" will bring up the following interface, where the reader needs to locate the path to the Tomcat home directory (the author's tomcat is extracted in the F:\Intellij-tomcat directory)

Click "OK" and go back to the interface as shown, indicating that the Tomcat path is configured.

Click "OK" in the pop-up screen to return to the following interface. Set the port number of "Http port" to 8080, as shown in the red box

Switch the tab to the "Deployement" screen, click "+" and select "Artifact ..." as shown in the red box

Change the path after "application context" to "/cms", as shown in the red box

Click "OK" to go back to the main edit page and click on the button as shown to launch Tomcat

As shown, Tomcat has successfully started

Enter localhost:8080/cms/in the browser address bar and have successfully accessed the index.jsp page under the CMS project. Now that Tomcat has started successfully.

Previous: Intellij Idea series of guide jar package and write unit Test (ii)

Intellij the tomcat environment of the Idea series (III.)

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.