IntelliJ IDEA 2022.1 Help

Getting started with Web service

To develop a Web service in IntelliJ IDEA, the corresponding module must be relevantly configured and supplied with all the required libraries and servlet references. This section describes the most common ways to meet these requirements.

Enable Web Services development support

This approach is applicable if you are going to develop a Web service of the type GlassFish/JAXWS2.X RI/Netro 1.X/JWSDP2.0 or Apache Axis.

Create a new project with Web Services

  1. Click New Project on the Welcome screen or select File | New | Project.

  2. From the Generators list, select Java Enterprise.

  3. Name the new project, select a build tool, a language you want to use, and select the Web application project template.

  4. Select the Create Git repository option to place the new project under version control.

  5. From the JDK list, select the JDK that you want to use in your project.

    If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory.

    If you don't have the necessary JDK on your computer, select Download JDK.

  6. On the next step of the wizard, select the Java EE version to be supported.

  7. From the Dependencies list, select Web Profile.

  8. Click Create.

Add Web Services to an existing module

  1. In the Project tool window (Alt+1), right-click the necessary module and select Add Framework Support.

  2. In the dialog that opens, select Web Application and select a version of the Servlet specification.

  3. If you want the deployment descriptor web.xml file to be created, select the Create web.xml checkbox.

    Click OK.

Add the necessary libraries

This approach is applicable if the necessary libraries have been previously downloaded.

  1. From the main menu, select File | Project Structure (Ctrl+Alt+Shift+S).

  2. From the panel on the left, select Modules, select the required module and open the Dependencies tab on the right.

  3. To enable Web development, click the Add button and select JARs or Directories... from the context menu. In the dialog that opens, select the javaee.jar library and click OK.

  4. Click the Add button again, then select JARs or Directories... from the context menu. In the dialog that opens, select the javaee.jar library and the required Web service-specific libraries.

    • The location of the javaee.jar library is defined during the installation of IntelliJ IDEA.

    • The location of the Web-service specific libraries is defined during their download.

  5. Click OK when ready.

Last modified: 10 August 2022