Java EE Learning (2): Using IntelliJ idea to develop Java Web

Source: Internet
Author: User
Tags windows download java web

Reference:http://www.cnblogs.com/carsonzhu/p/5468223.html

Developing the Java Web using IntelliJ idea

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 2017.3.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/, click on the left download Tomcat8.0 to enter the Tomcat download page:

64-bit version of Windows download 64-bit Windows Zip (PGP, MD5, SHA1), unzip to the desired directory:

After unzipping to the \bin\ directory, run Startup.bat, as shown below, if the server startup in XXXX Ms indicates that the Tomcat installation was successful.

Emphasis: The interface appears, indicating that the Java_home configuration is correct!!

Open the browser to test whether it started successfully

Appears as the previous window, indicating that the installation was successful, to close the console window can be turned off directly ~

However, if there is a

Or

Double-clicking the green version of Tomcat7w.exe appears "The specified service does not exist with the installed services", "unable to open the service" Tomcat6 ".

Later found the reason, the original is not installed this service. Specific installation method: Open the Command line Prompt window and enter the Tomcat installation directory ==> into the bin directory ==> input: Service.bat install, as follows:

Then restart: Press run \bin\ directory under Startup.bat, the Server startup in xxxx MS, start Tomcat, and then open the browser hostlocal:8080/appear as above interface.

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, as follows:

emphasis: (1) path toProject SDK : self-installing JDK path, as mine is: D:\relate_eclipse\Java\jdk1.8.0_121, Click Next to New ... button, the path can be loaded by step;

(2)application Server path : Here is the tomact background, that is, the use of their own installed tomact path, click New ... Add a path with the following path:

Where: Tomcat Home: such as D:\apache-tomcat-8.5.15, the following Tomcat base directory path is self-identifying.

My configuration is as follows:

Next, set the project name

The new results are as follows:

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. Set Project path: File---Project Structure, go to Project Structure window, click Modules, select Project "JavaWeb1", Switch to Paths tab, tick "use Modu Le compile output path, change both output path and Test output path to the classes directory you created earlier

4. Set Project dependency: Click Modules, select Item "JAVAWEB1", Switch to Dependencies tab, click "+" on the right, select "JARs or D Irectories "

Note: Open can be seen (if you follow the above steps to build the project, generally no problem, no longer set), Java Web Project is the JDK and tomcat package that you need to rely on to see (the servlet module is inside)

Then..

Click Modules, select the item "JAVAWEB1", switch to the Dependencies tab, click "+" On the right, select "JARs or Directories" and choose the following ( Select the built-in Web-inf\lib folder )

Then choose the following:

The results are as follows:

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. The output path is the Out folder under the current project and remains 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.

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--OK, this is the Tomcat configuration done.

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

Iv. running the project in Tomcat

Also attached: IntelliJ idea use tutorial (speak well!!) )

Java EE Learning (2): Using IntelliJ idea to develop Java Web

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.