Setup a JAVA Project in IntelliJ IDEA with Jakarta dependency and Tomcat server.
As I begin experiencing to setup java project for the first time, it’s really difficult for me to do so. After a lot of grind, I compiled my understanding and knowledge from the different sources and present in front of you in the form of a complete recipe to set up and run the project.
Here are the steps to set up and run the project :
Step 1: Install/download IntelliJ IDEA according to you respective version of Windows machine.
Download from here : https://www.jetbrains.com/idea/download/?section=windows
Step 2: Download Apache Tomcat server
According to you pc/laptop Windows version. The most stable version is 10.0.0, which runs smoothly in my case. Click on the first Zip file link to download, set up,and remember the path of the extracted folder
Download: https://tomcat.apache.org/download-10.cgi
Step 3: Open IntelliJ and set up a project with the Maven archetype.
Select the respective version of JDK (in my case jdk21), and the archetype must be webapp(i.e., org.apache.maven.archetypes:maven-archetype-webapp), then create the project. It takes some time and creates a project that must contain a src folder.
Get Rishi’s stories in your inbox
Join Medium for free to get updates from this writer.
Step 4: Add Apache Tomcat configuration to run the Maven project.
Click on the dropdown mention and image and edit the configurations.
Select Smart Tomcat, another window popup where you can configure your Tomcat Server path that you install in your machine using folder Icon 📁.
Then Apply and run the project.
Step 5: We need to add more dependencies to our project, that are insert in pom.xml. If you wish to you jakarta and mysql in your project you can use them by add this code to pom.xml
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>These are different dependencies for various tasks.
Step 6(Optional): In some cases the project is still not running because may the project have older version of jakarta (like 2.3) that not work with dependencies and Annotation. In that caseyou may replace the <web-app> code with this:
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
</web-app>Now, finally you can built and rerun the project by clicking on the ▶ button on the top, just beside the labled tomcat name.
Now…. Your weapons are ready for the warrior 😃 🔥.
Thanks for reading this article. If this article is helpful to you, then show your support 💪.






