Developing the Java Web using IntelliJ idea

Source: Internet
Author: User
Tags java web

Preface: Because I touch Java language time is relatively short, IDE tool Eclipse is also more familiar with the point, want to try IntelliJ idea to develop Java Web project to practice practiced hand!

First, download the installation article

1. Installing IntelliJ Idea

Official website: http://www.jetbrains.com/idea/download/, support mac/windows/linux three major mainstream platform, I use the Windows version.

Note: IntelliJ idea is a commercial software, with two versions,

Ultimate Edition is a commercial version, fully functional, can be free trial for 30 days, it is recommended to download the version of learning;

Community Edition is a free version of the community, features have been reduced, can be used for Google Android development (I started to download this version, today when doing this small test, found that cannot build a Web project, so re-installed the full version, alas wasted Time)

This time using IntelliJ idea 2016.1.1 ( JDK download installation and environment variable configuration ~)

Attached:IntelliJ idea Use tutorial ( Geek College) more comprehensive explanation

2.Tomcat Download Installation and configuration

Official website: http://tomcat.apache.org/

This download is apache-tomcat-9.0.0.m4-windows-x64

Then configure the environment variable (slightly)

Enter the installation directory for Tomcat Click Startup.bat, launch

Open the browser to test whether it started successfully

To turn off the console window directly

Ii. Creating a Web project

New Project 1.File, go to the Create Project window

Note: In IntelliJ idea, "new project" is equivalent to "workspace" in Eclipse, and "New Module" is the creation of a project. There's a big difference between this and eclipse.

2, right click on the Web-inf directory, New directory, create classes and lib two directories

(Note: Classes is used to store the compiled Java bytecode, and Lib holds the referenced jar package.) )

3, File--Project Structure, go to Project Structure window, click Modules, select Project "JavaWeb1", Switch to Paths tab, tick "Use mo Dule compile output path, change the output path and Test output path to the classes directory that you created earlier

4. Click Modules, select the item "JAVAWEB1", switch to the Dependencies tab, click "+" on the right, select "JARs or Directories"

Note: Java Web Project is the JDK and tomcat package that you need to rely on to see (the servlet module is inside)

5. Configure Packaging method artifacts: Click on the Artifacts tab, idea will automatically create a package named "Javaweb:war exploded" for the project, which means that it is packaged into a war package and is file-expandable with the output path under 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

Third, configure Tomcat

1, run, Edit configurations, go to the "Run Configurations" window, in the "Server" palette, uncheck "After launch", set "HTTP port" and "JMX Port", click Apply-and OK, so this tomcat configuration is complete.

Click on the "Deployment" tab, modify "Application Context", Apply---OK

Iv. running the project in Tomcat

Developing the Java Web using IntelliJ idea

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.