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, New directory, create classes and lib two directories

3. Project Structure, File, enter Project Structure window

4, click Modules, select the item "Javaweb", switch to the Paths tab, tick "Use module compile output path", "Output Path" and "Test out Put path is changed to the classes directory created earlier

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 called "Javaweb:war exploded" for the project, which is packaged into a war package, and is file-expandable, the output path is the current project Out folder, leave the default. Also tick "Build on 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", click "Configure ..." after "Application Server", eject the Tomcat server window, select the locally installed Tomcat directory, OK

4. In the "Server" palette of the "Run Configurations" window, remove the tick "after launch", set "HTTP port" and "JMX port", click Apply--and OK, and the Tomcat configuration is complete.

Iii. deploy and run the project in Tomcat

1, run, Edit configurations, go to the "Run Configurations" window, select the previously configured Tomcat, click on the "Deployment" tab, 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.