How to download J2EE API (javaee.jar) from Maven

This below java.net javaee.jar solution is only contains the J2ee APIs, it does not contain any method bodies. It’s fine for compilation, but not for run or deploy your application, because it will caused ” Absent Code attribute in method that is not native or abstract in class” or other method not found errors. Due to policy, it’s not possible to include this javaee.jar in any public Maven repository.

The best practice is always get the original full version of javaee.jar from the http://www.oracle.com/technetwork/java/javaee/overview/index.html, and include it into your project manually.

The J2EE API library (javaee.jar or javaee-api.jar) is not available in the default Maven repository (http://repo1.maven.org/maven2/). You need to download it from Java.Net repository.

1. Add Java.Net reporitory


<repository>
 	<id>Java.Net</id>
  	<url>http://download.java.net/maven/2/</url>
</repository>

2. Add the J2EE dependency


<dependency>
   	<groupId>javax</groupId>
   	<artifactId>javaee-api</artifactId>
   	<version>6.0</version>
</dependency>

Full pom.xml example


<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd">
  
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mkyong</groupId>
  <artifactId>SpringWebExample</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>SpringWebExample Maven Webapp</name>
  <url>http://maven.apache.org</url>
  
  <repositories>
  	<repository>
  		<id>Java.Net</id>
  		<url>http://download.java.net/maven/2/</url>
  	</repository>
  </repositories>
  
  <dependencies>
    <!-- Javaee API -->
	<dependency>
    	<groupId>javax</groupId>
    	<artifactId>javaee-api</artifactId>
    	<version>6.0</version>
	</dependency>
  </dependencies>
  <build>
    <finalName>SpringWebExample</finalName>
  </build>
</project>

Reference

  1. http://weblogs.java.net/blog/ludo/archive/2007/01/java_ee_5_apis.html

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Arkady
Guest
Arkady

In my case, the library javaee-api.jar cause an exception java.lang.ClassNotFoundException

gabb
Guest
gabb

Thanks, very useful. Please note that for JEE 5, your dependency would be available from Maven Central repo with this definition:

	<dependency>
    	<groupId>javaee</groupId>
    	<artifactId>javaee-api</artifactId>
    	<version>5</version>
	</dependency>
trackback
java.lang.ClassNotFoundException: javax.el.ExpressionFactory

[…] How to download javaee.jar from Maven This article was posted in JSF2 category. Oracle Magazine – Free Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for Java's developers and DBAs, and more. […]

trackback
java.lang.ClassNotFoundException: javax.transaction.TransactionManager

[…] </dependencies> The downloaded javaee.jar is not contains any method bodies, see this “how to get javaee.jar from Maven” article for detail. VN:F [1.9.1_1087]please wait…Rating: 0.0/10 (0 votes […]

trackback
java.lang.ClassNotFoundException: javax.persistence.Entity

[…] </dependencies> The downloaded javaee.jar is not contains any method bodies, see this “how to get javaee.jar from Maven” article for detail. VN:F [1.9.1_1087]please wait…Rating: 0.0/10 (0 votes […]

trackback
Maven Tutorials | Tutorials

[…] J2EE API (javaee.jar) […]