I have installed development environment Intellij ideea
and java 11
. I read that java 11
do not support javax.servlet package
, because it is a part of Java EE
and can not create a servlet
. But what do I need to do to create a servlet? To install java 8 EE? or if there is a video how to fix it, because I've read a lot of articles but I don't understand how to fix it.
Asked
Active
Viewed 6,158 times
1

Richard Walker
- 133
- 2
- 10
-
You might want to read https://stackoverflow.com/questions/15774924/just-what-is-java-ee-really, Java and JavaEE are two different but complementary things. Actually it's Jakarta EE now by the way. – Gaël J Jan 09 '22 at 08:01
-
Jakarta EE (formerly Java EE) is merely a wide collection of a few dozen specifications for software that you might want to run on your Java SE implementation (a JDK). [Jakarta Servlet](https://jakarta.ee/specifications/servlet/) is one such spec. The Servlet spec defines an API which is represented as Java code in a JAR, mostly interfaces. You need a copy of that JAR while developing. But do not bundle with your Servlet. You will deploy your Servlet to a Servlet container like Tomcat or Jetty. That container comes with its own copy of the API along with its own particular implementation. – Basil Bourque Jan 09 '22 at 17:01
1 Answers
4
You can totally do it with Java 11, the only depedency you need is:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
Here you can find a working demo example https://github.com/asgarov1/servlet_app

J Asgarov
- 2,526
- 1
- 8
- 18
-
-
1Answer could be improved by showing both the old `javax.*` and new `jakarta*` package naming. – Basil Bourque Jan 09 '22 at 17:07