Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java EE JDK [duplicate]

I know this has been asked a million times and I did do my homework, but the one last thing I don't fully understand is, is there a "Java EE JDK" ?

When I download the SDK, it tries to install lots of crap I don't want. So I did some reading and realized that actually the Java SDK is a set of tools technically unrelated to the JDK. So what I am looking for is a clean simple standalone download of the JDK only.

We know that "Java SE JDK" has always been available from Sun's (now Oracle) website. However, I am developing a web application and interested in some of the Java EE features: javax.servlet, javax.validation, javax.persistence and javax.transaction. So in effect what I'm really looking for is a "Java EE JDK".

I'm using a typical Maven / Tomcat / Spring / Hibernate setup and in the past I've always added API-only dependencies in provided scope in Maven to my project for these parts of the Java EE specification, i.e:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
</dependency>

So if I do this for all the Java EE APIs that my project requires, then I am actually using Java SE JDK with some additional manually-declared Java EE components. Furthermore when I direct my IDE to use the JDK that came with the Java EE SDK installation, these additional namespaces aren't available.

In other words, for all intents and purposes it would appear that the JDK that comes with the Java EE SDK download is equivalent to the JDK that I get when I install the "Java SE JDK"... If this is correct then there is no need for me to install the Java EE SDK and I can simply use the Java (SE) JDK declaring any Java EE components that I need as *-api/provided dependencies the way I described above.

So my questions is: is what I describe above the right way to go, or is there such a thing as a "Java EE JDK"? i.e a JDK that comes with the unimplemented interfaces of things like javax.servlet and javax.resources and so on? And if such a beast exists, where would I download it from?

like image 544
Amir Abiri Avatar asked May 03 '12 19:05

Amir Abiri


1 Answers

What you're asking is "can I get all the EE components" as a single download without GlassFish, NetBeans, etc.

Well it's helpful to know exactly what Java EE really is. It's a set of specifications of sometimes related / sometimes unrelated "Enterprise" level components (whatever Enterprise means :)). For example, the servlet-api spec (as indicated by a previous answer) is part of the Java EE spec. So is the JTA (transaction API), JPA, Java Mail, and so on.

There are two types of EE component. 1. Those which are shipped as interfaces only and the application-server or a third party implements them. Examples are JTA, JPA, Servlet-API. 2. Those which are shipped as full reference implementations. Examples are Java-Mail. I can't think of others off top of my head but there will be some.

Now a full application server, such as glassfish, ships with the set of implementations so lots of times people see them inside Glassfish, Websphere etc and think that they need that to use them. A container such as Tomcat is not an application server, it is a servlet-container and thus only implements a subset of the full Java EE stack (the parts that are required for servlets only).

In order to get the full set of Java EE interfaces/implementations you would need to add the separate interfaces or implementations to your build. In that case you just "have to know" where to find them, and that comes by experience. People tend to know that JPA is added as part of the Hibernate dependencies for example.

like image 139
sksamuel Avatar answered Oct 08 '22 02:10

sksamuel