Where does the Jar file come from? I expected it to be either a part of the JDK or Eclipse. That expectation proved to be wrong.
Asked
Active
Viewed 9.4k times
3 Answers
67
Sun/Oracle is providing a java-ee.jar - which contains only the Java EE APIs and does not contain any method bodies - that you can use to compile against it (from the java.net maven repository):
- For Java EE 5: http://download.java.net/maven/1/javaee/jars/javaee-api-5.jar
- For Java EE 6: http://download.java.net/maven/2/javax/javaee-api/6.0/javaee-api-6.0.jar
If you want to execute some Java EE code, you'll need a Java EE application server, they provide an implementation of the Java EE APIs. For example, for Java EE 6, there is GlassFish.

Pascal Thivent
- 562,542
- 136
- 1,062
- 1,124
-
How can i add the java-ee dependency in my pom? – Kayser Aug 27 '12 at 12:45
-
3@Kayser: You should typically be adding the dependency as a provided dependency in your POM: `
javax javaee-api 6.0 provided javax.j2ee j2ee 1.4 provided
8
if you want javaee-api-7.jar, use maven dependency
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
or you can download from here

nobody
- 223
- 4
- 5
-
This is the correct and recommended solution according to the best practices. Simple and functional. Thanks. – Juan Sebastian Jun 15 '20 at 20:47
3
Download Glassfish or JBOSS or another Java EE app server. They all have it.

duffymo
- 305,152
- 44
- 369
- 561
-
1It’s better to include the dependency as suggested in other answers, then you can swap between Glassfish, TomCat, JBoss without having to check your code is compatible. – Christian Dec 12 '17 at 09:00
-
No, it'll be a problem if the app server includes the JAR and there's a conflict. Better yet - don't use Java EE anymore. Go with Spring Boot. It's almost 2018. Java EE is dead. – duffymo Dec 12 '17 at 11:52