IntelliJ idea 14.x integrates with Tomcat to create and run a Java Web project

Source: Internet
Author: User
Tags tomcat server

Create a Web project

1.File --New project, enter the Create Project window

2, right click on the web-inf directory,Newdirectory, create classes and Lib two directories

3.Project Structure, File, enter Project Structure window

4, click Modules , select the item "javaweb", switch to Paths tab, tick "Usemodule compile output pa Th", change"Output path"and"Test output Path"to the previously created classes directory

5, click Modules , select the item "javaweb", switch to the Dependencies tab, click "+" On the right, select " JARs or Directories"

Note: Java Web projects are required to rely on the view of the JDK and Tomcat package (the Servlet module is on the inside)!

6, configuration packaging method artifacts: Click on the Artifacts tab , Idea will automatically create a package named "Javaweb:war exploded" for the project, indicating Packaged into a war package, and is file-expandable, the output path is the Out folder under the current project and remains the default . Also tick "Buildon Make", indicating that the compile time package deployment, tick "Show content of elements", indicating the display of a detailed list of content.

" Reference ":

Intellij the difference between facets and artifacts in idea 14.x

The role and difference of Java's packaged jar, war, ear package

Intellij the difference between compile, make and build in the Idea 14.x menu item

Ii. Configuring Tomcat

1,Run, Edit configurations, go to "Run Configurations" window

2. Create a new Tomcat container by clicking "+", " Tomcat Server ," Local

3. Enter a new service name at "name" and click "Configure ..." after "Application Server" to eject the Tomcat Server window, Select the locally installed Tomcat directory, OK

4. In the "Server" palette of the "Run configurations" window, uncheck "Afterlaunch", set "HTTP port" and " JMX Port", click Apply -- OK, this is the Tomcat configuration done.

Iii. deploy and run the project in Tomcat

1,run , Edit configurations, go to the "Run Configurations" window, select the previously configured Tomcat, click " Deploymenttab, click "+", "Artifact", select the Artifact of the Web project you created

2, modify "application Context", Apply , OK

3. Run Tomcat to view running results in the browser

IntelliJ idea 14.x integrates with Tomcat to create and run a Java Web project

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.